Puppet is an automated administrative engine for your Linux, Unix, and Windows systems, performs administrative tasks (such as adding users, installing packages, and updating server configurations) based on a centralized specification.

Before proceeding note that in this example I have below os version and puppet version.
OS : CentOS release 6.5
Puppet server version : 3.8.2
Puppet client version : 3.8.2
Host Names:
Server: master.example.testlab
Client: client.example.testlab

Puppet Server installation and Configuration

Step1: Setting up your /etc/hosts file

Add following entries to you /etc/hosts files on server and client

# vi /etc/hosts
192.168.1.100  master.example.testlab master
192.168.1.101  client.example.testlab client

Step2 : Installing Puppet Server  :

On  master.example.testlab run following commands to install puppet server and client

# yum install puppet-server
# yum install puppet

Make sure facter fqdn and hostname -f return the correct fqdn for your master:

$ facter fqdn

master.example.testlab

$ hostname -f

master.example.testlab

Step3:  Edit /etc/puppet/puppet.conf file on master.example.testlab

# vi /etc/puppet/puppet.conf
[main]
     logdir = /var/log/puppet
     rundir = /var/run/puppet
     ssldir = $vardir/ssl
[master]
    certname = master.example.testlab
    dns_alt_names = master, master.example.testlab
    autosign = true
[agent]
     classfile = $vardir/classes.txt
     certname = master.example.testlab
     server = master.example.testlab

 Step4 : Generate New Certificate on puppet master

Creating new CA certificates by running the following command:

# puppet master --verbose --no-daemonize

Once all above configuration is done.

Step5: Start puppet  master service.

# service puppetmaster start

Step6: Creating manifests

# vi /etc/puppet/manifests/site.pp
node client.example.testlab {

         group { 'testgroup':
               ensure => 'present',
               gid    => '1005',
         }

        user { 'testuser':
             ensure  => 'present',
             comment => ' testuser through puppet',
             gid     => '1005',
             home    => '/home/testuser',
             shell   => '/bin/bash',
             uid     => '1005',
       }
 
 }

Puppet Client installation and Configuration

Make sure you have made host entries in your /etc/hosts file as suggested in step1

Step1: Installing puppet client on client.example.testlab

# yum install puppet

Step2: Edit and configure puppet.conf file

# vi /etc/puppet/puppet.conf
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter

[agent]
server = master.example.testlab

Step3: Run agent test

puppet agent --test

You will see the user has been created via puppet.

Working with Puppet Certificates :

How to To list all puppet certificates :

puppet cert list -a

How to revoke puppet certificate :

puppet cert revoke hostname.domainname

How to  Cleaning puppet cert:

puppet cert clean hostname.domainname

How to Sign puppet client certificate :

puppet cert sign hostname.domainname

 


Warning: count(): Parameter must be an array or an object that implements Countable in /home/vhosts/howtolinuxblog.orgfree.com/wp-includes/class-wp-comment-query.php on line 399

Leave a Reply

Free Web Hosting