How to Install Puppet Master and Client in Ubuntu 14.04

March 18, 2015 | By
| Reply More

Hi there, Greetings. Today, we'll be learning how to install and configure both the puppet master and puppet client in our latest stable release of Ubuntu ie. Ubuntu 14.04 LTS "Trusty".

Puppet is a configuration management system that allows you to define the state of your IT infrastructure, then automatically enforces the correct state. Whether you're managing just a few servers or thousands of physical and virtual machines, Puppet automates tasks that sysadmins often do manually, freeing up time and mental space so sysadmins can work on the projects that deliver greater business value. It ensures consistency, reliability and stability. It also facilitates closer collaboration between sysadmins and developers, enabling more efficient delivery of cleaner, better-designed code.

1. Configuring hosts

We have 2 machines:

Master puppet with IP 192.168.1.102 and hostname : puppetmaster
Puppet client with IP 192.168.1.103 and hostname : puppetclient

Now add these 2 lines to /etc/hosts on both machines

nano /etc/hosts

192.168.1.102 puppetmaster.example.com puppetmaster

192.168.1.103 puppetclient.example.com puppetclient

adding puppet to hosts

In addition to that both client and server must have time sync, it will processed in both client and server machines as follows:

ntpdate pool.ntp.org ; apt-get update && sudo apt-get -y install ntp ; service ntp restart

2. Installing Puppet packages (Client and Master server)

$ sudo apt-get update

Client

$ sudo apt-get install puppet

install puppet client

Master server

$ sudo apt-get install puppet puppetmaster

install puppetmaster

Now Define the manifest on the Server.

$ sudo nano /etc/puppet/manifests/site.pp

{codecitation}package {

‘apache2′:

ensure => installed

}

service {

‘apache2′:

ensure => true,

enable => true,

require => Package['apache2']

}

package {

‘vim’:

ensure => installed

}

# Create “/tmp/testfile” if it doesn’t exist.

class test_class {

file { “/tmp/testfile”:

ensure => present,

mode => 600,

owner => root,

group => root

}

}

# tell puppet on which client to run the class

node puppetclient {

include test_class

}

{/codecitation}

puppetmaster configuration

From this configuration the puppet master will deploy the installation of apache and will create /tmp/testfile with the above ownership.

Now start the Puppet master:

sudo /etc/init.d/puppetmaster start

Define the Server in the Puppet Client :

edit /etc/puppet/puppet.conf and add

sudo nano /etc/puppet/puppet.conf

{codecitation}[puppet]

server = puppetmaster.example.com

# Make sure all log messages are sent to the right directory

# This directory must be writable by the puppet user

logdir=/var/log/puppet

vardir=/var/lib/puppet

rundir=/var/run

{/codecitation}

Now, run the command below and start the deployment.

# puppetd -server puppetmaster.example.com -waitforcert 60 -test

Get back to The Server and check who is waiting

# puppetca --list

Now back to The Client you will see this :

Check from the Client that the Test files has been created with the same ownership 600 defined on the Master

$ sudo ls -ltr /tmp/testfile

check if the apache is running with

$ ps -ef | grep apache2

Reload the puppet client

# puppetd -v -o

check now if apache is installed and running

ps -ef | grep apache2

Conclusion

Above We have just mentioned how we can revoke the cert and disconnect the Desktop from Puppet master server. As mentioned above we can connect N number of desktops and do the administrations centrally through the Puppet master server. Congratulations! Now we have a fully functional Puppet instance on our Ubuntu 14.04.

Filed Under : MONITORING, UBUNTU HOWTO

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.