Part 1 - Basic Puppet Master Setup
Contents
Installing Puppet and Puppetmaster on the Master
As this tutorial is based on a CentOS 5.2 server we will use Fedora EPEL to install Puppet, you should first configure your system to use EPEL.
Other options for installing puppet is documented on the wiki for Debian, Hat and CentOS, OpenBSD, OS X, Gentoo and FreeBSD
master# yum install puppet puppet-server facter . . . Running Transaction Installing: facter ######################### [1/3] Installing: puppet ######################### [2/3] Installing: puppet-server ######################### [3/3] Installed: puppet-server.noarch 0:0.24.4-1.el5 Dependency Installed: facter.noarch 0:1.3.8-1.el5 puppet.noarch 0:0.24.4-1.el5 Complete!
Configure DNS
In this simple tutorial we will use the default method for client machines to contact the master and that is via a CNAME in DNS for puppet
To override this you need to set certname and server in the configuration file, refer to ConfigurationReference
You should arrange for this either through /etc/hosts or through DNS, in this example I added 'puppet' to localhost in /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.1.5 puppet
And to verify this worked we can use ping
master# ping puppet PING puppet (192.168.1.5) 56(84) bytes of data. 64 bytes from puppet (192.168.1.5): icmp_seq=1 ttl=58 time=1.53 ms --- puppet ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 1.539/1.539/1.539/0.000 ms
Both the master and all clients should be able to resolve puppet
Set up the basic site configuration
When the puppetmaster needs to find the logic to apply to a client it starts to look for the manifest in a file called /etc/puppet/manifests/site.pp on Red Hat based systems by default.
You can find out where you system is looking by doing /usr/sbin/puppetmasterd --genconfig|grep "manifest ="
In theory you can put all your code in this one file, but that is not viable once your manifest becomes large so we split it out into separate directories, create the site.pp file with the following contents:
import "nodes/*.pp" import "classes/*.pp"
And create two directories:
master# mkdir /etc/puppet/manifests/nodes /etc/puppet/manifests/classes
Set up file serving
Puppet has the ability to distribute files using an internal protocol, to enable this you should set up the file server using /etc/puppet/fileserver.conf, a very simple one is included below and should be sufficient for our current needs, you should replace the IP addresses with your own:
Feel free to replace /srv/puppet/fileserver with a directory of your choice
[files] path /srv/puppet/fileserver allow 192.168.0.0/24 allow 127.0.0.1
Now create the directory in question:
master# mkdir -p /srv/puppet/fileserver
Finishing off
This concludes the basic setup for a simple puppetmaster, it's low on features at the moment but we will flesh it out as we go along, specifically without any files in nodes and manifests nothing will be able to use it, but we will start putting those in place in part 2.
Your puppetmaster should now have a directory structure along these lines:
/etc/puppet/ |-- fileserver.conf |-- manifests | |-- classes | |-- nodes | `-- site.pp `-- puppet.conf
/srv/puppet/ `-- fileserver
You're now ready to start on Part 2 where we set up some basics and prepare to run our first client connection.
