In this article we will learn how to configure Puppet with Ubuntu 16.04. When we think about managing services on plethora of Linux nodes in bulk, we think of puppet. The magical tool used to manage services like configurations,, services and user management in a single shot. The tool makes life easy for system admin, he can spare time for  more productive works; because now he can avoid repetitive tasks. In this article we will learn how to configure Puppet with Ubuntu 16.04. Puppet is based on ruby language, but no expertise in ruby are required for sys admin.

Prerequisites before installing Puppet on Ubuntu 16.04

The puppet server is configured by default to use 2 GB of RAM, although you can change the settings as required, the packages comes with Ubuntu 16.04 as default; therefore no need to add additional repo. We required two separate machines, one will be acting as Puppet master server ans second one will be used as Agent node.

Server node  ip : 192.168.1.101

Agent node ip : 192.168.1.102

Server node hostname : server.puppet.local

Agent node hostname: agent.puppet.local

Procedure to configure Puppet Server on Ubuntu 16.04

Assure that server and client machines are ready with IP addresses conflagrations.

Change Hostname

Update system

Configure domain name or changing hostname will be sufficient in our example scenario.

Open /etc/hosts and edit.

Edit /etc/hostname

Restart server.

Test settings

selection_068

Configure puppet server

Download and install puppet .deb package.

Install package

Update system

Install puppetmaster package.

Configure puppet configuration file, define DNS/FQDN name in puppet.conf file.

Sample output

Start puppetmaster service

Selection_046

Generate new CA certificate

To see the generated certificates, type

Sample output

Create puppet server manifests using .pp files

Puppet use .pp format files to configure settings for agents, these instructions are written in ruby language and such instructions are termed manifests, all of the service, application file or directory deployment on puppet nodes are done by using these manifests. Create a new site.pp file in default puppet manifest directory.

Configure Puppet Agent node

We already have a newly installed ubuntu 16.04 machine with hostname “agent” and ip addr 192.168.1.102.

Have a look how the /etc/hosts file look like

Selection_047

Download puppet .deb package in install, as we did in previous step.

Install other required packages

Configure puppet agent

Edit puppet.conf file

Amend follwoing line in the end of file to define serve for this puppet node.

Sample output

Start puppet service

Test running node, avoid error message generated first time

Selection_044

When this command is run first time on agent node, it will send a certificate request automatically to the puppet master server, the puppet master have to sign these certificate only then the recognized puppet master-node communication will be possible. Login to the server, and run following command

Sample output

Sign new request

Create new manifest on Puppet server

Append  /etc/puppet/manifests/site.pp file as follows

Sample output

Login to agent node and run

Have a look in /tmp directory

Selection_048

File is created to the agent node successfully. Append site.pp file for other application installations and configuration management as well.

Configure Apache tomcat with puppet

Login to Server node, Search Apache tomcat package using following command

Have a look on the list displayed

Install package on server node using following command

The above command will install package in server and will create a example .pp file in /etc/puppet/modules/, have a look

Sample output

Have a look in examples directory

Sample output

Open  instance_with_listener.pp, and copy contents

Paste contents to site.pp in /etc/puppet/manifests/

Sample output

Save and exit, and switch to agent node and run following command

If all things are on right track, process will be complete like below

selection_067

Verify, weather tomcat is installed successfully on agent node or not.

Run script

Sample output

Above message will indicate that the package is installed on agent successfully, in same way we can install other applications on agent node with a single kick via puppet tool.

Conclusion

Puppet is one of the finest example of devops tools, you may required to configure NTP (Network Time Protocol) in addition on both of the nodes and server machine, while using the application in real life scenario. In my first attempt I tries to configure puppet server using “puppetserver” package and got encountered with some problems, but things go smooth with “puppetmaster” package. Try to create puppet server agent node in testing environment first, if thing go smooth; you can deploy server in real life.

Spread the love
  • 13
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here