We are going to learn here how to setup puppetserver (puppetmaster) and puppet agent (puppet) on ubuntu 16.04
Environment setup for puppet
Lets not create a virtual box which is quite heavier than docker so here I will be using the docker container with Ubuntu 16.04 images and all necessary packages like curl, vim installed. If you don’t know about docker please refer about it first or optionally you can setup the environment using virtualbox. The problem with virtual box is as they takes a lot of memory size and hardware, you need a good configuration system with enough memory to allocate the resources to newly created virtual box .
Here the environment for our puppet master and agent will be something like bellow
- a docker container with ubuntu 16.04 images used as puppet master
- a docker container with ubuntu 16.04 images used as puppet agent
You can also use some other operating system of your choice like centos and create your lab environment. if you are using the docker container than you may need to add the curl and whatever does not comes build in with docker.
How to setup puppet master in ubuntu 16.04
Assuming we are inside the first docker container where we will set up the puppet master. Type the following commands where we are just adding the puppetlab packages there after we will be installing the puppet master (puppetserver)
curl -O https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb sudo dpkg -i puppetlabs-release-pc1-xenial.deb sudo apt-get update
Note same will be used for the puppet agent initial package setup
Now we are ready to install puppet master.
apt-get install puppetserver
This will install the puppetserver in our first docker container.
Verify the puppetserver is installed properly
To verify if the puppetserver is installed properly type
which should return a puppetserver version.
if you get the problem like puppetserver command not found though your puppetserver was installed successfully, the reason can be that your puppetserver is not being setup in the environment path and hence you are not able to run the command. So to set it up in the environment path follow these guide. how to fix puppetserver not found error.
We have successfully added the puppetserver now need few setup to be done which will be the way to define this is the puppetserver(puppetmaster).
open the puppet configuration file /etc/puppetlabs/puppet/puppet.conf
Setting up the puppet agent in ubuntu 16.04
follow the above process of installing the puppet labs package ,we will be adding the same package in the puppet agent too and than create an agent. After finishing the above method now time to add the puppet agent.
installing puppet agent in ubuntu 16.04
$ sudo apt-get install puppet
verify to see if it is installed or not
type puppet which should result in showing some descriptions
configure puppet agent conf file
the puppet agent config file is located here /etc/puppet/puppet.conf
Here we are letting the puppet agent know that the puppet master machine with the name we assigned for the puppet master
set the host name of puppet master in /etc/hosts
put the ip address of the puppet master followed by its name. Suppose the ip address of puppet master machine is 188.8.131.52. So the /etc/hosts will have
Summarizing The puppet master and puppet agent installation process
- get the package from the puppetlabs
- install the puppetserver
- configure the puppetserver conf file in /etc/puppetlabs/puppet/puppet.conf adding the dns_alt_names setting
- Repeat step-1 in puppet agent machine
- install the puppet ,which is the puppet agent for us
- configure the puppetagent conf file located in /etc/puppet/puppet.conf adding the servername setting
- add the puppet master machine ip address and name in /etc/hosts
This is the overall steps required in puppet master and puppet agent setup in ubuntu 16.04 machine.
Note: Some path may vary depending upon the version of puppet you are using. This has been tested on new version of puppet.