bundles/c3voc-addons: add upgrade-and-reboot to bundle
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-01-17 18:43:30 +01:00
parent 0f0ee046b1
commit 0893156723
Signed by: kunsi
GPG key ID: 12E3D2136B818350
6 changed files with 39 additions and 1 deletions

View file

@ -55,6 +55,8 @@ DEBIAN_FRONTEND=noninteractive apt-get -y -q autoremove
if [[ -f /var/run/reboot-required ]]
then
% if 'mail' in data:
date | mail -s "SYSREBOOTNOW ${node.name}" ${data['mail']}
% endif
systemctl reboot
fi

View file

@ -0,0 +1 @@
../../apt/files/check_unattended_upgrades

View file

@ -0,0 +1 @@
../../apt/files/upgrade-and-reboot

View file

@ -51,6 +51,25 @@ directories = {
},
}
files = {
'/usr/local/share/icinga/plugins/check_unattended_upgrades': {
'mode': '0755',
},
'/usr/local/sbin/upgrade-and-reboot': {
'content_type': 'mako',
'mode': '0700',
'context': {
'data': node.metadata.get('apt', {}).get('unattended-upgrades', {}),
}
},
'/etc/cron.d/upgrade-and-reboot': {
'content': '{minute} 1 * * {day} root /usr/local/sbin/upgrade-and-reboot'.format(
minute=node.magic_number % 30,
day=node.metadata.get('apt', {}).get('unattended-upgrades', {}).get('day', 5),
),
},
}
for vhost, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
if not 'domain' in config:
config['domain'] = vhost
@ -78,4 +97,12 @@ for vhost, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
svc_systemd = {
'nginx': {},
'apt-daily.timer': {
'running': False,
'enabled': False,
},
'apt-daily-upgrade.timer': {
'running': False,
'enabled': False,
},
}

View file

@ -1,5 +1,12 @@
defaults = {
'icinga2_api': {
'apt': {
'services': {
'UNATTENDED UPGRADES': {
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_unattended_upgrades',
},
},
},
'nginx': {
'services': {
'NGINX PROCESS': {

View file

@ -1,5 +1,5 @@
% for monitored_node in sorted(monitored_nodes):
% if monitored_node.has_bundle('apt'):
% if not monitored_node.dummy:
object ScheduledDowntime "unattended_upgrades" {
host_name = "${monitored_node.name}"