bundles/apt: support spreading unattended-upgrades in a group
This commit is contained in:
parent
92cca7f396
commit
048fb83ee7
5 changed files with 81 additions and 24 deletions
|
@ -1,31 +1,18 @@
|
|||
% for monitored_node in sorted(repo.nodes):
|
||||
<%
|
||||
auto_updates_enabled = (
|
||||
monitored_node.has_any_bundle(['apt', 'c3voc-addons'])
|
||||
or (
|
||||
monitored_node.has_bundle('pacman')
|
||||
and monitored_node.metadata.get('pacman/unattended-upgrades/is_enabled', False)
|
||||
)
|
||||
) and not monitored_node.metadata.get('icinga_options/exclude_from_monitoring', False)
|
||||
%>\
|
||||
% if auto_updates_enabled:
|
||||
object ScheduledDowntime "unattended_upgrades" {
|
||||
host_name = "${monitored_node.name}"
|
||||
% for dt in downtimes:
|
||||
object ScheduledDowntime "${dt['name']}" {
|
||||
host_name = "${dt['host']}"
|
||||
|
||||
author = "unattended-upgrades"
|
||||
comment = "Downtime for upgrade-and-reboot of node ${monitored_node.name}"
|
||||
author = "${dt['name']}"
|
||||
comment = "${dt['comment']}"
|
||||
|
||||
fixed = true
|
||||
|
||||
ranges = {
|
||||
% if monitored_node.has_bundle('pacman'):
|
||||
"${days[monitored_node.metadata.get('pacman/unattended-upgrades/day')]}" = "${monitored_node.metadata.get('pacman/unattended-upgrades/hour')}:${monitored_node.magic_number%30}-${monitored_node.metadata.get('pacman/unattended-upgrades/hour')}:${(monitored_node.magic_number%30)+30}"
|
||||
% else:
|
||||
"${days[monitored_node.metadata.get('apt/unattended-upgrades/day')]}" = "${monitored_node.metadata.get('apt/unattended-upgrades/hour')}:${monitored_node.magic_number%30}-${monitored_node.metadata.get('apt/unattended-upgrades/hour')}:${(monitored_node.magic_number%30)+30}"
|
||||
% endif
|
||||
% for d,t in dt['times'].items():
|
||||
"${d}" = "${t}"
|
||||
% endfor
|
||||
}
|
||||
|
||||
child_options = "DowntimeTriggeredChildren"
|
||||
}
|
||||
% endif
|
||||
% endfor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue