bundlewrap/bundles/systemd/items.py

53 lines
1.4 KiB
Python
Raw Normal View History

timezone = node.metadata.get('timezone', 'UTC')
actions = {
'systemd-reload': {
'command': 'systemctl daemon-reload',
'cascade_skip': False,
'triggered': True,
'needed_by': {
'svc_systemd:',
},
},
'systemd-hostname': {
'command': 'hostnamectl set-hostname {}'.format(node.metadata['hostname']),
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(node.metadata['hostname']),
# Provided by bundle:basic
'needs': {
'file:/etc/hosts',
},
},
'systemd-timezone': {
'command': 'timedatectl set-timezone {}'.format(timezone),
'unless': 'timedatectl status | grep -Fi \'time zone\' | grep -i \'{}\''.format(timezone.lower()),
},
'systemd-enable-ntp': {
'command': 'timedatectl set-ntp true',
'unless': 'timedatectl status | grep -Fi \'ntp service\' | grep -i \'active\'',
'needs': {
'svc_systemd:systemd-timesyncd',
},
},
}
2020-12-12 09:39:57 +00:00
files = {
'/etc/systemd/journald.conf': {
'content_type': 'mako',
'context': {
'journal': node.metadata.get('systemd/journal', {}),
2020-12-12 09:39:57 +00:00
},
'triggers': {
'svc_systemd:systemd-journald:restart',
},
},
}
svc_systemd = {
'systemd-journald': {
'needs': {
'file:/etc/systemd/journald.conf',
},
},
'systemd-timesyncd': {},
2020-12-12 09:39:57 +00:00
}