defaults = { 'pacman': { 'ask_before_removal': { 'glibc', 'pacman', }, 'parallel_downloads': 4, 'repository': 'http://ftp.uni-kl.de/pub/linux/archlinux/$repo/os/$arch', 'unattended-upgrades': { 'day': 5, 'hour': 21, }, }, } @metadata_reactor.provides( 'cron/jobs/upgrade-and-reboot', 'icinga2_api/pacman/services', ) def patchday(metadata): if not metadata.get('pacman/unattended-upgrades/is_enabled', False): return {} day = metadata.get('pacman/unattended-upgrades/day') hour = metadata.get('pacman/unattended-upgrades/hour') return { 'cron': { 'jobs': { 'upgrade-and-reboot': '{minute} {hour} * * {day} root /usr/local/sbin/upgrade-and-reboot'.format( minute=node.magic_number % 30, hour=hour, day=day, ), }, }, 'icinga2_api': { 'pacman': { 'services': { 'UNATTENDED UPGRADES': { 'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_unattended_upgrades', }, }, }, }, }