bundles/c3voc-addons: support cron definition
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
0893156723
commit
63cdd470cf
3 changed files with 26 additions and 6 deletions
1
bundles/c3voc-addons/files/cron_template
Symbolic link
1
bundles/c3voc-addons/files/cron_template
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../cron/files/cron_template
|
|
@ -62,14 +62,17 @@ files = {
|
||||||
'data': node.metadata.get('apt', {}).get('unattended-upgrades', {}),
|
'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 crontab, content in node.metadata.get('cron', {}).items():
|
||||||
|
files['/etc/cron.d/{}'.format(crontab)] = {
|
||||||
|
'source': 'cron_template',
|
||||||
|
'content_type': 'mako',
|
||||||
|
'context': {
|
||||||
|
'cron': content,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for vhost, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
|
for vhost, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
|
||||||
if not 'domain' in config:
|
if not 'domain' in config:
|
||||||
config['domain'] = vhost
|
config['domain'] = vhost
|
||||||
|
|
|
@ -18,6 +18,22 @@ defaults = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'cron/upgrade-and-reboot'
|
||||||
|
)
|
||||||
|
def patchday(metadata):
|
||||||
|
day = metadata.get('apt/unattended_upgrades/day', 5)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'cron': {
|
||||||
|
'upgrade-and-reboot': '{minute} 1 * * {day} root /usr/local/sbin/upgrade-and-reboot'.format(
|
||||||
|
minute=node.magic_number % 30,
|
||||||
|
day=day,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
@metadata_reactor.provides(
|
||||||
'icinga2_api/nginx/services',
|
'icinga2_api/nginx/services',
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue