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(
|
2022-02-05 10:41:41 +00:00
|
|
|
'cron/jobs/upgrade-and-reboot'
|
2021-01-07 17:44:38 +00:00
|
|
|
)
|
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': {
|
2022-02-05 10:41:41 +00:00
|
|
|
'jobs': {
|
|
|
|
'upgrade-and-reboot': '{minute} {hour} * * {day} root /usr/local/sbin/upgrade-and-reboot'.format(
|
|
|
|
minute=node.magic_number % 30,
|
|
|
|
hour=hour,
|
|
|
|
day=day,
|
|
|
|
),
|
|
|
|
},
|
2020-11-14 11:24:55 +00:00
|
|
|
},
|
|
|
|
}
|