Puppet Installation

How to Install a Puppet Master and Client Server on Centos 5.2

Puppet is an open-source next-generation server automation tool. It is composed of a declarative language for expressing system configuration, a client and server for distributing it, and a library for realizing the configuration.

IMPORTANT !!! Setup the EPEL repos for Centos – choose the correct package depending on your installation.

If i386 or i6886 (32 bit)

rpm -Uvh epel-release-5-4.noarch.rpm

If x86_64 (64 bit)

rpm -Uvh epel-release-5-4.noarch.rpm

Install puppet-server

yum install puppet-server

The 1.8.5 branch of Ruby shipped will RHEL5 can exhibit memory leaks. So install ruby 1.8.6++ (I did not on this server as it was test not a production server).

Install the help docs

yum install ruby-rdoc

If you are facing any problems while installing puppet, then it might be due to ruby installation. You need to remove the current ruby installation and use the following steps to install ruby and its dependencies.Please install the same in the following order

   Note: example is for centos 5 and 64 bit, change the rpms depends upon the OS version and architecture
   libselinux-ruby-1.33.4-5.7.el5  == >> wget ftp://mirror.switch.ch/pool/3/mirror/centos/5.7/os/x86_64/
   CentOS/libselinux-ruby-1.33.4-5.7.el5.x86_64.rpm
   rpm -Uvh libselinux-ruby-1.33.4-5.7.el5.x86_64.rpm
   ruby-libs-1.8.5-19.el5_6.1      == >> wget ftp://mirror.switch.ch/pool/1/mirror/scientificlinux/5rolling/
   x86_64/SL/ruby-ibs-1.8.5-19.el5_6.1.x86_64.rpm
   rpm -Uvh uby-ibs-1.8.5-19.el5_6.1.x86_64.rpm
   ruby-augeas-0.4.1-1.el5         == >> wget http://epel.mirror.freedomvoice.com/5/x86_64/ruby-augeas-0.4.1-1.el5.x86_64.rpm
   rpm -Uvh ruby-augeas-0.4.1-1.el5.x86_64.rpm
   ruby-shadow-1.4.1-7.el5         == >> wget http://epel.mirror.freedomvoice.com/5/x86_64/ruby-shadow-1.4.1-7.el5.x86_64.rpm
   rpm -Uvh ruby-shadow-1.4.1-7.el5.x86_64.rpm
   ruby-1.8.5-19.el5_6.1           == >> wget http://oss.oracle.com/ol5/SRPMS-updates/ruby-1.8.5-19.el5_6.1.src.rpm
   rpm -Uvh ruby-1.8.5-19.el5_6.1.src.rpm
   facter-1.5.8-1.el5              == >> wget http://epel.mirror.freedomvoice.com/5/x86_64/facter-1.6.1-1.el5.noarch.rpm
   rpm -Uvh facter-1.6.1-1.el5.noarch.rpm

Then download puppet rpm

   puppet rpm :-  wget http://epel.mirror.freedomvoice.com/5/x86_64/puppet-2.6.6-3.el5.noarch.rpm

Then install puppet

  rpm -Uvh puppet-2.6.6-3.el5.noarch.rpm

Create a manifest file at /etc/puppet/manifests/site.pp

vi /etc/puppet/manifests/site.pp

put this in it

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

class test_class {

file { “/tmp/testfile”:

ensure => present,

mode => 644,

owner => root,

group => root

}

}

# tell puppet on which client to run the class

node pclient {

include test_class

}

Start the puppet server

service puppetmaster start

Enable start on boot

chkconfig puppetmaster on

Now to install the Puppet Client on another server

IMPORTANT !!! Setup the EPEL repos for Centos – choose the correct package depending on your installation.

epel-release-5-4.noarch.rpm

Install ruby-libs, ruby, augeas-libs, ruby-augeas, ruby-shadow using rpm

Install puppet client

yum install puppet

Edit the file /etc/puppet/puppet.conf with the following. Replace “server = server.master.com” with your puppet server, if you are not using server.master.com as puppet server.

[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl

[agent]
    server = server.master.com
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig
    #listen = true

Setup puppet client to generate its own certificate request to the server.

/etc/init.d/puppet once -v

Sign the certificate request on the puppet master server. Use puppetca –list to see if any are available to sign.

puppetca –-sign puppet01

Puppet01 must be the fully qualified domain name (FQDN) of you client server.

Once this is done, check the client has been added to the puppet server fine. It should list it.

puppetca -la | grep hostname

Eg:

[root@im ~]# puppetca -la | grep clientserver.com
+ clientserver.com

Run this on the client server again to retrieve the certificate

/etc/init.d/puppet once -v

Make the puppet start with the system

chkconfig puppet on

Make sure it is working on the client server.

puppetd –-test

You should see a dialog that creates the file /tmp/testfile

Thats all folks !

Note:

To remove and re-add an already added puppet client to puppet server:

======================

You can use the following steps to remove and re-add an existing puppet client from the puppet master server

1. Command to remove the puppet client from the puppet master

  puppetca --clean clienthostname

2. Then you need to reinstall puppet client on client server

  To install puppet client, please refer the "puppet installation" KB entry

3. At puppet client generate certificate

  /etc/init.d/puppet once -v

4. Then use the following command to authorize the certificate

   puppetca --sign clienthostname

If it is not shown in the “puppetca –list –all” list then please add the server details in the client’s /etc/hosts file and clients details in the servers /etc/hosts file.

Then regenerate the certificate again

Then client should appear in the “puppetca –list –all” list

==================================

ERROR: If you see error like below when running puppetd –test follow the solution.

notice: Run of Puppet configuration client already in progress; skipping

Solution: Puppet believes that it is already running. If this isn’t the case then you may have a stale lock file. Check with “ps axf” to see if puppetd is running, if it isn’t then delete the lockfile (/var/lib/puppet/state/puppetdlock is likely location).

rm -rf /var/lib/puppet/state/puppetdlock

run puppetd –test now

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: