2020-10-18 13:33:41 +00:00
|
|
|
defaults = {
|
2021-05-13 07:10:33 +00:00
|
|
|
'apt': {
|
2022-01-23 04:47:42 +00:00
|
|
|
'unattended-upgrades': {
|
2021-05-13 07:10:33 +00:00
|
|
|
'day': 5,
|
|
|
|
'hour': 21,
|
|
|
|
},
|
|
|
|
},
|
2020-11-10 08:50:20 +00:00
|
|
|
'icinga2_api': {
|
|
|
|
'apt': {
|
|
|
|
'services': {
|
|
|
|
'UNATTENDED UPGRADES': {
|
|
|
|
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_unattended_upgrades',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-10-18 13:33:41 +00:00
|
|
|
}
|
2020-11-14 11:24:55 +00:00
|
|
|
|
|
|
|
|
2021-01-07 17:44:38 +00:00
|
|
|
@metadata_reactor.provides(
|
|
|
|
'cron/upgrade-and-reboot'
|
|
|
|
)
|
2020-11-14 11:24:55 +00:00
|
|
|
def patchday(metadata):
|
2022-01-23 04:47:42 +00:00
|
|
|
day = metadata.get('apt/unattended-upgrades/day')
|
|
|
|
hour = metadata.get('apt/unattended-upgrades/hour')
|
2020-11-14 11:24:55 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
'cron': {
|
2021-02-12 17:53:25 +00:00
|
|
|
'upgrade-and-reboot': '{minute} {hour} * * {day} root /usr/local/sbin/upgrade-and-reboot'.format(
|
2020-11-14 11:24:55 +00:00
|
|
|
minute=node.magic_number % 30,
|
2021-02-12 17:53:25 +00:00
|
|
|
hour=hour,
|
2020-11-14 11:24:55 +00:00
|
|
|
day=day,
|
|
|
|
),
|
|
|
|
},
|
|
|
|
}
|