Agree.
Thanks
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c6307d1b-fa76-4b97-a46d-ed50a0c24bcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Facter.add(:updates_already_running) do
confine :osfamily => "Debian"
setcode do
if Facter::Util::Resolution.exec("ps aux | grep 'dpkg\|apt-get' | grep -v grep")
"yes"
end
end
end
class system_updates {
# ==Purpose
# This class is used for running system updates on all Linux assets.
#
# ==Actions
# * Compiles a list of available updates
# * Ensures that any pending package problems are resolved
# * Applies all available updates
# * Automatically cleans up any packages that are no longer needed
# * Empties genericadmin's mailbox
# * Reboots the system if any updates require it
#
#
if ( $::updates_already_running ) {
}
else {
Exec["lock_prep"] -> Exec["apt_prep"] -> Exec["apt_update"] -> Exec["apt_fix"] -> Exec["apt_upgrade"] -> Exec["apt_remove"] -> Exec["empty_mailbox"] -> Exec["reboot"]
#
#
exec { "lock_prep":
command => "rm -f /var/lib/dpkg/lock ; rm -f /var/lib/apt/lists/lock ; rm -f /var/cache/apt/archives/lock",
}
exec { "apt_prep":
command => "rm -rf /var/lib/apt/lists/* ; mkdir /var/lib/apt/lists/partial",
}
exec { "apt_update":
command => "apt-get update",
}
exec { "apt_fix":
command => "apt-get -f install",
}
exec { "apt_upgrade":
command => "apt-get -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" -y --force-yes dist-upgrade",
}
exec { "apt_remove":
command => "apt-get -y autoremove",
}
exec { "empty_mailbox":
command => 'echo "" > /home/genericadmin/mbox',
onlyif => "test -f /home/genericadmin/mbox",
}
exec { "reboot":
command => "reboot",
onlyif => "test -f /var/run/reboot-required",
}
}
}
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/42e006cd-df5d-4284-95ff-c243585c1eeb%40googlegroups.com.
Thanks Martin. It sounds really good.
Would you share some configuration on place?
When you say patching you mean only linux with packages updates?
Regards
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAFcmyypmOqzNAvFS2jGhH-bFqLUo1xuYmoy0Bs0foK-P%2B2HC0Q%40mail.gmail.com.