I am writing this post as part of course Linuxin keskitetty hallinta held by Tero Karvinen. In this post I will be install PuppetMaster and I share my puppet configures to my slaves computers (virtual machines). This is very important part of centralized management because after that you will be able to manage your managed computers software in one place.

In this instructions I use multiple virtual machines by vagrant. If you want to use vagrant too, I have getting started post here: http://nikokiuru.com/2013/11/vagrant-boot-multiple-virtual-machines/

Preinstall PuppetMaster I was getting up two virtual machines master and slave with same hostnames.

In Ubuntu 12.04 is not default installed avahi-daemon, so .local (mDNS) domains are not available. We would like to use .local domains with puppet, so we install avahi-daemon:

master$ sudo apt-get -y install avahi-daemon

I ping master computer by slave to verify that everything working as well:

slave$ ping master.local

Install PuppetMaster

master$ sudo apt-get -y install puppetmaster

Configure PuppetMaster

In some cases is better first delete puppet ssl certificates. Puppet genereta it to back when we start PuppetMaster again.

master$ sudo service puppetmaster stop
master$ sudo rm -r /var/lib/puppet/ssl

Modify Puppet config-file:

master$ sudoedit /etc/puppet/puppet.conf

Add master’s host under [master] -tag

dns_alt_names = puppet, master.local

Start PuppetMaster:

master$ sudo service puppetmaster start

Connecting slaves

Install puppet:

slave$ sudo apt-get -y install puppet

And modify config-file:

slave$ sudoedit /etc/puppet/puppet.conf

Add master DNS name under [agent] -tag:

[agent]
server = master.local

Modify puppet to start automatically:

slave$ sudoedit /etc/default/puppet

Change start to yes:

START=yes

Start puppet:

slave$ sudo service puppet restart

Accept Slave certificate

master$ sudo puppet cert --list

master$ sudo puppet cert --sign slave1.example.com

Create new Puppet module

master$ cd /etc/puppet

master$ sudo mkdir -p modules/hello/manifests/

master$ sudoedit modules/hello/manifests/init.pp
class hello {
  file { '/tmp/hello':
    content => "Hello PuppetMaster!\n"
  }
}

Create site manifest

master$ cd /etc/puppet
master$ sudoedit manifests/site.pp

Add next code line in site.pp:

class{"hello":}

Test

slave$ sudo service puppet restart
slave$ less /tmp/hello

If hello file is no there immediately, wait some time and try again.

Source:
http://terokarvinen.com/2012/puppetmaster-on-ubuntu-12-04