bundles/cron: ensure cron is installed and running

This commit is contained in:
Franzi 2021-07-02 06:36:51 +02:00
parent a2501ed2cb
commit 7ac7c1a2b7
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 27 additions and 0 deletions

View file

@ -1,3 +1,10 @@
if node.os == 'arch':
service_name = 'cronie'
package_name = 'pkg_pacman:cronie'
else:
service_name = 'cron'
package_name = 'pkg_apt:cron'
files = { files = {
'/etc/crontab': { '/etc/crontab': {
'content_type': 'mako', 'content_type': 'mako',
@ -16,6 +23,14 @@ directories = {
}, },
} }
svc_systemd = {
service_name: {
'needs': {
package_name,
},
},
}
for crontab, content in node.metadata.get('cron', {}).items(): for crontab, content in node.metadata.get('cron', {}).items():
files['/etc/cron.d/{}'.format(crontab)] = { files['/etc/cron.d/{}'.format(crontab)] = {
'source': 'cron_template', 'source': 'cron_template',

12
bundles/cron/metadata.py Normal file
View file

@ -0,0 +1,12 @@
defaults = {
'apt': {
'packages': {
'cron': {},
},
},
'pacman': {
'packages': {
'cronie': {},
},
},
}