Skip to content

Instantly share code, notes, and snippets.

@garthk
Created September 15, 2012 03:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save garthk/3726289 to your computer and use it in GitHub Desktop.
Save garthk/3726289 to your computer and use it in GitHub Desktop.
Use Puppet to ensure Ubuntu can get the latest Puppet
class puppetlabs {
# Install Puppet repository and call apt-get update
case $operatingsystem {
ubuntu: {
$key = "4BD6EC30"
exec { 'apt-key puppetlabs':
path => "/bin:/usr/bin",
unless => "apt-key list | grep '${key}' | grep -v expired",
command => "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${key}",
}
file { 'apt source puppetlabs':
ensure => present,
path => "/etc/apt/sources.list.d/puppetlabs.list",
content => "deb http://apt.puppetlabs.com ${lsbdistcodename} main\n",
}
file { 'old puppet list':
path => "/etc/apt/sources.list.d/puppet.list",
ensure => absent,
}
exec { 'apt-get update puppetlabs':
command => "/usr/bin/apt-get update",
require => [Exec['apt-key puppetlabs'], File['apt source puppetlabs']],
creates => "/var/lib/apt/lists/apt.puppetlabs.com_dists_${lsbdistcodename}_main_binary-${architecture}_Packages",
timeout => 3600,
}
}
}
}
@garthk
Copy link
Author

garthk commented Oct 23, 2012

To quickly use:

curl -O https://raw.github.com/gist/3726289/b6a10fd055eb9ea20f1c30d27e6d3f69fb1fa493/puppetlabs.pp ; sudo puppet apply -e 'include puppetlabs'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment