Skip to content

Instantly share code, notes, and snippets.

@reidmv
Created November 11, 2014 20:18
Show Gist options
  • Save reidmv/5ef70b8446ae6c336cc5 to your computer and use it in GitHub Desktop.
Save reidmv/5ef70b8446ae6c336cc5 to your computer and use it in GitHub Desktop.
Yum Repo Updates pattern in Puppet
class updates (
$update_repo = 'patchlevel',
$enforce = false,
) {
yumrepo { 'patchlevel':
baseurl => "http://${::servername}/patches",
descr => 'Patch Level Repo',
enabled => 1,
gpgcheck => 1,
gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6',
}
exec { 'yum-updates':
command => "yum --disablerepo '*' --enablerepo '${update_repo}' update -y",
unless => "yum --disablerepo '*' --enablerepo '${update_repo}' check-update",
logoutput => true,
path => '/usr/bin',
noop => !$enforce,
require => Yumrepo['patchlevel'],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment