Monday, January 27, 2014

puppet master

Puppet.conf is the main configuration file of puppet. On most of the distribution this file is located under, /etc/puppet/ directory. Most of the times this file (/etc/puppet/puppet.conf) is automatically created during the installation. But if it is not there, you can easily create it by the following command.
[root@slashroot1 ~]# puppetmasterd --genconfig > /etc/puppet/puppet.conf
Puppet.conf file is easier to understand, and is very much self explanatory. Its divided into different sections as the following.

[agent] -- this section is for mentioning agent specific parameters.
[master] -- this section is for specifying options for puppet master.
[main] -- this section will contain all global configuration options.

Main section will contain options like the log directory,pid directory etc.(don't worry we will go ahead and configure all those, be patientsmiley)
The first step is to configure the /etc/hosts file and DNS entries with the ip of puppet master and its FQDN(Fully Qualified Domain Name).
Am keeping my puppet master name as puppet.slashroot.in. So my host entries will be something like the below.
[root@slashroot1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               slashroot1.slashroot.in slashroot1 localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.0.102 slashroot1.slashroot.in puppet puppet.slashroot.in

Also don't forget to add the same DNS entry in DNS server for your infra.
Now lets configure the [master] section of our puppet.conf file.
We will only be adding certname parameter in [master] section as of now. If you don't have the master section in your puppet.conf file then create it. My master section looks like the below.
[master]
certname=puppet.slashroot.in
Now lets configure an important file in puppet master configuration. Its the site.pp file. This is the file which tells what are the configurations that needs to be applied to the clients(agents).
We will be placing this site.pp file in /etc/puppet/manifests/ directory. Just create a file called site.pp there with no content. We will be adding configuration content inside this file later.

 

What are manifests in puppet?

manifest is nothing but a name that puppet calls those files which contain the configuration options for the clients.
An important fact to note is that all manifest files will also have a .pp extension just the same as site.pp file
You can alter the location of manifests and site.pp file with the help of manifestdir and manifest options in puppet.conf file.
As i have mentioned in my post How does Puppet Work Puppet does all its communication through SSL. And the default directory for SSL certificates is /var/lib/puppet.
[root@slashroot1 ~]# ls /var/lib/puppet/
bucket        client_data  facts  reports  server_data  state
clientbucket  client_yaml  lib    rrd      ssl          yaml

Now lets start puppetmaster, which will start master server listening on the port 8140. Starting puppet master server will also create a self signed certificate for the master server which can be found at /var/lib/puppet/ssl/ca/signed/
[root@slashroot1 signed]# /etc/init.d/puppetmaster start
Starting puppetmaster:
[root@slashroot1 signed]# ls /var/lib/puppet/ssl/ca/signed/
puppet.slashroot.in.pem
[root@slashroot1 signed]# lsof -i :8140
COMMAND    PID   USER   FD   TYPE DEVICE SIZE NODE NAME
puppetmas 3552 puppet    7u  IPv4   9583       TCP *:8140 (LISTEN)
[root@slashroot1 signed]#

As shown in the above example we have started puppet master, which inturn created a signed certificate for our puppet master, (note the fact that the certificate name is exactly the same as the certname in puppet.conf file).

 

What methods can be used to start puppet master server?

Puppet master can be started by the below methods.
#/etc/init.d/puppetmasterd start
OR
#puppetmasterd
OR
#puppet  master
For troubleshooting purposes you can run puppet master as the following.
#puppet master --verbose --no-daemonize

No comments:

Post a Comment