Puppet : Addinng additional Client Nodes

In my initial blog at http://zaman4linux.blogspot.com/2014/11/quick-howto-puppet-installation-and.html , we had seen how to install and configure Puppet Server and Client.

Now we will see further in adding additional clients to the puppet server .

The steps are as follows:

1.  Edit puppet.conf on server to add the entry for new client as shown below
     dns_alt_names = xqa2.example.com , xqa3.example.com
  
2. Edit site.pp to add the entry for new host with the rule to add a file

      node "xqa3.example.com" {
            file { "/home/blaskar/zamanhosts.txt":
                             ensure => file,
                             owner  => "root",
                             group  => "root",
                             mode   => 0644
                            content => "Node1.example.com"
                   }
           } 


On puppet client we will execute the following steps

1. First install the puppet software

         yum install  puppet

2. Start  the puppet client

         puppet agent --verbose --no-daemonize --onetime


On puppet Server,  check whether server has received request to sign the certificate for the new client

  1.   puppet cert list
  "qa3.example.com" (SHA256) 18:46:03:B3:0A:0B:38:6B:1F:3D:9E:DB:E4:B0:0C:C3:EE:54:D7:1D:0B:31:A8:2E:4B:3F:EF:74:68:78:5A:5A
  
  2.   puppet cert --sign  qa3.example.com
       Notice: Signed certificate request for qa3.example.com
       Notice: Removing file Puppet::SSL::CertificateRequest   qa3.example.com.pempuppetclient.in at '/var/lib/puppet/ssl/ca/requests/qa3.example.com.pem'


Back on  client , we will execute the below client so that the changes are replicated to client. 

$ puppet agent --verbose --no-daemonize --onetime
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for xqa3.example.com
Info: Applying configuration version '1450246605'
Notice: /Stage[main]/Main/Node[xqa3.example.com]/File[/home/blaskar/zamanhosts.txt]/ensure: defined content as '{md5}4fbb6be005b2040f8c3fe406351351b6'
Notice: Finished catalog run in 0.04 seconds



If we want to add more text to the contents  of  "/home/blaskar/zamanhosts.txt" as defined in manifests ,  just add the contents in the manifests file as shown below and no need to restart puppetmaster  service. 

node "xqa3.example.com" {
            file { "/home/blaskar/zamanhosts.txt":
                             ensure => file,
                             owner  => "root",
                             group  => "root",
                             mode   => 0644
                            content => "Node1.example.com\n Node2.example.com"
                   }
           } 

Following message below can be seen that the new information has been compiled into Puppet Server

Notice: Compiled catalog for mel-xqa3.wiley.com in environment production in 0.04 seconds

Run the following command  below on client  to apply the changes

 $ sudo puppet agent --verbose --no-daemonize --onetime
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for xqa3.example.com
Info: Applying configuration version '1450326260'
Info: Computing checksum on file /home/blaskar/zamanhosts.txt
Info: /Stage[main]/Main/Node[xqa3.example.com]/File[/home/blaskar/zamanhosts.txt]: Filebucketed /home/blaskar/zamanhosts.txt to puppet with sum 4fbb6be005b2040f8c3fe406351351b6
Notice: /Stage[main]/Main/Node[xqa3.example.com]/File[/home/blaskar/zamanhosts.txt]/content: content changed '{md5}4fbb6be005b2040f8c3fe406351351b6' to '{md5}07e687cc218453dc5ca4e9e3bc1300ba'
Notice: Finished catalog run in 0.06 seconds



Verify whether the contents were replicated properly

$cat zamanhosts.txt
Node1.example.com
Node2.example.com 



 

Comments

Popular Posts