Skip to content

Instantly share code, notes, and snippets.

@peelman
Forked from garthk/puppetlabs.pp
Created July 12, 2016 12:16
Show Gist options
  • Save peelman/4000b281ddea90b9a5f326328c8fb4d0 to your computer and use it in GitHub Desktop.
Save peelman/4000b281ddea90b9a5f326328c8fb4d0 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,
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment