OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

2.3. Configuration


Create a folder path for the apache2 class:


sudo mkdir -p /etc/puppet/modules/apache2/manifests


Now setup some resources for apache2. Create a file /etc/puppet/modules/apache2/manifests/init.pp

containing the following:


class apache2 { package { 'apache2':

ensure => installed,

}


service { 'apache2': ensure => true, enable => true,

require => Package['apache2'],

}

}


Next, create a node file /etc/puppet/code/environments/production/manifests/site.pp with:


node 'puppetclient.example.com' { include apache2

}


image

Replace puppetclient.example.com with your actual Puppet client's host name.


The final step for this simple Puppet server is to restart the daemon:


sudo systemctl restart puppetmaster.service


Now everything is configured on the Puppet server, it is time to configure the client.


First, configure the Puppet agent daemon to start. Edit /etc/default/puppet, changing START to yes:


START=yes


Then start the service:


sudo systemctl start puppet.service


View the client cert fingerprint


sudo puppet agent --fingerprint


Back on the Puppet server, view pending certificate signing requests:


sudo puppet cert list


On the Puppet server, verify the fingerprint of the client and sign puppetclient's cert:


sudo puppet cert sign puppetclient.example.com


On the Puppet client, run the puppet agent manually in the foreground. This step isn't strictly speaking necessary, but it is the best way to test and debug the puppet service.


sudo puppet agent --test


Check /var/log/syslog on both hosts for any errors with the configuration. If all goes well the apache2 package and it's dependencies will be installed on the Puppet client.


image

This example is very simple, and does not highlight many of Puppet's features and benefits. For more information see Section 2.4, “Resources” [p. 109].


Top OS Cloud Computing at OnWorks: