Why I enjoy puppet

Having to configure 17 servers that have to be absolute alike and other such details, made me setup puppet to do the job. I've used cfengine before, so I was looking forward to using puppet for a larger project and see if it made me as happy as I'd hoped (compared to using cfengine which can be a bit tedious :)

The general goal is that everything is setup up by puppet, so that the restore plan is as simple as possible:

Step 1: Make sure you have your puppet server
Step 2: Install a basic setup (ubuntu/centos using kickstart config in this setup)
Step 3: add the host to puppet with the relevant role assigned - and voila :)

I needed to define several files for postfix, that all need to have postmap run on them, if they are updated.

This can be done as simple as this:

define postfix::postmapfile($name) {
exec { "postmap$name":
command => "/usr/sbin/postmap /etc/postfix/$name",
refreshonly => true,
require => [
file { "/etc/postfix/$name":
ensure => present,
mode => 644,
source => "puppet://puppetmaster.u.net/postfix/$name",
notify => Exec["postmap$name"]

And then I simply enter this to create the relevant file (virtual, generic or whatever) in the relevant section:

        postfix::postmapfile { "virtual": name => virtual }
postfix::postmapfile { "generic": name => generic }
postfix::postmapfile { "transport": name => transport }

And this creates 3 files /etc/postfix/virtual, generic and transport and makes sure to run postmap on them, if I modify them. It could also easily be extended to trigger a postfix reload.

1 comments on Why I enjoy puppet

  1. Anonymous
    Tue, 06/15/2010 - 12:12
    Thanks man :-)