Tuesday, April 8, 2014

Puppet + Centos - Master and Client

Configuring the Puppet Master and client.

Following the below step in both Master and client for initial configuration.

Downloading and installing needed RPM for the Puppet

rpm -ivUh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Installing the Puppet Server

yum install puppet-server

Installing the client

yum install puppet

Setting up the hostname and making sure the master and client are able to connect to each other.

echo "
xxx.xxx.xxx.xxx master.puppet.com

xxx.xxx.xxx.xxx client.puppet.com

" >> /etc/hosts

ping -c 3 client.puppet.com

ping -c 3 master.puppet.com

Setting the Iptables .

Either we need to switch the Iptables off or Open the port 8140

iptables -A INPUT -p tcp --dport 8140 -m state --state NEW,ESTABLISHED -j ACCEPT

Once the above setting is done in both server and client .


Start the server
[root@master ~]# /etc/init.d/puppetmaster restart

Stopping puppetmaster: [FAILED]

Starting puppetmaster: [ OK ]

Now from client try checking for signed Certificates.
[root@client ~]# puppetd --server=master.puppet.com --waitforcert 60 --test  

Now the client will ask for certificate to master server , Now we need to check and sign the clients certificate from master server

[root@master ~]# puppetca --list

"client.puppet.com" (B7:B2:29:23:E9:D1:F1:BB:DB:EA:A4:76:E4:D2:67:63)

[root@master ~]# puppetca --sign client.puppet.com

notice: Signed certificate request for client.puppet.com

notice: Removing file Puppet::SSL::CertificateRequest client.puppet.com at '/var/lib/puppet/ssl/ca/r


[root@master ~]# puppetca --list

If you have reached here with out any error then half of the thing is done. Now we need to create the configuration for the clients in the master. we need to add the configuration to  /etc/puppet/manifests/site.pp file. you can find a sample configuration file below.

Sample Configuration page

[root@master ~]# cat /etc/puppet/manifests/site.pp
# Create "/tmp/testfile" if it doesn't exist.
file { "/tmp/outside":
ensure => present,
mode => 644,
owner => root,
group => root
class test_class {
file { "/tmp/testfile":
ensure => present,
mode => 644,
owner => root,
group => root
package {
ensure => installed }
service {
ensure => true,
enable => true,
require => Package['httpd']
# tell puppet on which client to run the class
node client {
include test_class
[root@master ~]#


No comments:

Post a Comment