Monday, January 23, 2017

Continuous Deployment - Puppet master & puppet agent in docker containers

Installing & Running puppet server(master) & puppet agent in docker containers


Create puppet docker containers

Choose a suitable & stable puppet image from dockerhub and install in your docker server -> $ docker pull devopsil/puppet ->


Alternatively, create your own docker file ->


Install a docker container with a suitable puppet master name -> $ Docker run --name puppetmaster -it devopsil/puppet bash -> Install another docker container with a suitable puppet agent name -> $ Docker run --name puppetagent -it devopsil/puppet bash ->

Configure hostname in puppetmaster container with a meaningful name in network file -> # vi etc/sysconfig/network -> HOSTANME=master.demo.com -> Configure hostname in puppetagent container with a meaningful name in network file -> # vi etc/sysconfig/network -> HOSTNAME=agent.demo.com ->

Configure hostname in puppetmaster & puppetagent with same name in hosts file -># vi etc/hosts -> [masterip] 172.17.0.2 master.demo.com -> [agentip] 172.17.0.3 agent.demo.com ->

Ping master form agent and agent from master to test network connection between puppetmaster & puppetagent containers->


Install puppet server & puppet agent in docker containers

Install puppet server in puppetmaster container -># yum install –y puppet puppet-server facter -> install puppet agent in puppetagent container -># yum install –y puppet facter ->


Update puppet.conf file under [main] in puppetmaster container -># vi etc/puppet/puppet.conf -> certname = master.demo.com -> Update puppet.conf file in puppetagent container -># vi etc/puppet/puppet.conf -> server = master.demo.com ->


Start puppet master in puppetmaster container -># service puppetmaster start -># service puppetmaster status ->


Authenticate puppet agent in puppet master

Request certification from agent -># puppet agent --test –server=[master hostname]master.demo.com --waitforcert=50 -> check for certificate request in master -># puppet cert list -> sing certification in master -># puppert cert sign [agent hostname]agent.demo.com ->


Test an example

Create a puppet policy file in puppet master in manifest folder -> # vi etc/puppet/manifest/site.pp ->


Apply the configuration change in puppet agent -># Puppet agent –-test


1 comment: