Puppet Tutorial: Configuring Puppet Master

Sarath Pillai's picture
puppet master in linux

We had a look at installing puppet master and puppet agent in our previous post. In this post we will be going ahead with, some initial configurations.

We will start with the initial basic configuration on our puppet master server(slashroot1). We will go through the configuration files which are necessary.

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

In our next post we will configure puppet agent for the first time.

Rate this article: 
Average: 4.1 (42 votes)

Comments

I have done configuration of Puppet on Ubuntu but now I need a steps for configuration of puppet to synchronize multiple computers for Ubuntu. So I can install though puppet on single computer which results installation on all remaining computers.So no need to install manually on each computer separately. It will save the time.So I need a help for this configuration for Ubuntu.

Sarath Pillai's picture

Hi samidha,

I guess you are asking how to have same configuration for multiple servers, which will fetch the configs from a puppet master server. For that, you need to first have a set of modules ready, for example apache, ssh, nginx and whatever applications you require, with the configuration file etc.

I recommend reading the below post to get an idea of creating a sample configuration

Puppet manifest tutorial

Then you can go ahead and include your nodes in the puppet master server as shown below.

node 'www1.example.com' {       
include apache       
include ssh       
include nginx     
}     
node 'www2.example.com' {       
include apache       
include ssh       
include nginx     
}

From your comment i feel like you need the same configs on many servers then you can have the below config.

node 'node1.example.com', 'node2.example.com', 'node3.example.com' {
      include apache, ssh, nginx
    }

Hope that helps..

 

Hi,

How to Install Tomcat in PE

How to install JBoss in PE

I am installing Tomcat and JBoss Modules.

Adding classes in PE Console

Implement site.pp and nodes.pp

But i got errors

It is not installing successfully

1. run as a root user, running with other user may show "permission denied"

2. check ports, may be other services may be running on the same port :8080

3. check manifest file syntax

Hi,

I just installed Puppet on my Ubuntu 12.04 Centos 6.5 server and even though there were no errors, no puppet.conf file or site.pp file was created. When I tried the command mentioned by you, I get:

root@<>2:~# puppetmasterd --genconfig > /etc/puppet/puppet.conf
The program 'puppetmasterd' is currently not installed. You can install it by typing:
apt-get install puppetmaster

But the puppetmaster is already installed

root@<>:~# apt-get install puppetmaster
Reading package lists... Done
Building dependency tree
Reading state information... Done
puppetmaster is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 39 not upgraded.

Please help.

Sarath Pillai's picture

Hi,

I think you might have installed the latest version of puppet. Some commands have changed in the latest version. You can actually do all these stuff with the single puppet command.

Try puppet master --genconfig commandline. It has several options.
If that's not working, lemme know which version of puppet you have installed.

Many Thanks
Sarath

I have installed Puppet 3.7.3.I am not able to find puppet.conf file.
As you said I have tried with "puppet master --genconfig" but it says "Puppet Master is not supported on Microsoft Windows".

Is there any other option other than going for lower versions of puppet

# /etc/init.d/puppetmaster start
Starting puppetmaster: Could not parse configuration file: Certificate names must be lower case; see #1168 [failed]

I want to install the puppet in Ubuntu M/c .
Please help me on the same.
I don't know how to start the same .

Getting error Could not run: Could not create PID file: /var/run/puppet/maste.pid

OS version -suse linux 11 sp2

Also just want to know ,I have installed puppet via zypper repository but I dont know whether it is puppet server or puppet agent in my VM as I am installing the same package in other VMs and considering them as a agent .

# sudo puppet master --verbose --no-daemonize
Notice: Starting Puppet master version 3.8.7
Error: Could not run: Could not create PID file: /var/run/puppet/master.pid

try by giving permission to the puppet directory

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.