Thursday, April 28, 2011

Upgrading puppet 0.25.4 to puppet 2.6.6 in Ubuntu 10.04 LTS

If you are administering Ubuntu servers with puppet, getting the latest puppet to work can be a painful process.  So, this is what I ended up doing.  It may not be the best way, and probably still has some kinks to work out, but this will get you started.

I have a module called puppet.  In the /path/to/modules/puppet/manifests/init.pp I have the usual:

import "classes/*.pp"

in classes/puppet_client.pp, I have:

class puppet::client {
    include apt
    include monit::puppet

    package { "puppet":
        ensure => latest,
        notify => Service["puppet"],
    }

    package { "facter":
        ensure => latest,
        notify => Service["puppet"],
     }

    file { "/etc/puppet/auth.conf":
        source  => "puppet:///modules/puppet/auth.conf",
        owner   => "puppet",
        group   => "puppet",
        mode    => "640",
        notify  => Service["puppet"],
        require => [Package["puppet"], Package["facter"]],
    }

    file { "/etc/puppet/namespaceauth.conf":
        source  => "puppet:///modules/puppet/namespaceauth.conf",
        owner   => "puppet",
        group   => "puppet",
        mode    => "640",
        notify  => Service["puppet"],
        require => [Package["puppet"], Package["facter"]],
    }

    file { "/etc/puppet/puppet.conf":
        source  => "puppet:///modules/puppet/puppet.conf",
        owner   => "puppet",
        group   => "puppet",
        mode    => "640",
        notify  => Service["puppet"],
        require => [Package["puppet"], Package["facter"]],
    }

    file { "/etc/default/puppet":
        source  => "puppet:///modules/puppet/puppet",
        owner   => "puppet",
        group   => "puppet",
        mode    => "640",
        notify  => Service["puppet"],
        require => [Package["puppet"], Package["facter"]],
    }
    service { "puppet":
        ensure     => running,
        enable     => true,
        hasstatus  => true,
        hasrestart => true,
    }

    # puppet PPA
    case $operatingsystem {
        Ubuntu :  {
            apt::key { "AFF68B78":
                ensure => present,
            }
            apt::sources_list { "aroth-puppet.list":
                ensure  => present,
                content => "deb http://ppa.launchpad.net/aroth/ppa/ubuntu ${lsbdistcodename} main",
                notify  => Exec["apt-get_update"],
            }
        }
    }
}


The key part of this is installing Andreas Roth's PPA.  It's a great PPA and usually up to date.

So this is how it works.  Once the Ubuntu repo is added, it should trigger an apt-get update.  The next time puppet checks for updates, it should notice there is a higher version of puppet and facter, and upgrade those.  The upgrade should trigger puppet to be restarted, and it should be on the new version.

You should have the different configuration files in your /path/to/modules/puppet/files directory and edited to taste.

I also use three other modules:
Well, I hope this helps some people out there.  Sometimes I find that it can't update without some intervention, but it seems to work for the most part.  Let me know if you have any recommendations!

No comments:

Post a Comment