bundlewrap/bundles/systemd/items.py

24 lines
596 B
Python
Raw Normal View History

2020-09-27 14:46:54 +00:00
if 'hostname' in node.metadata:
hostname = node.metadata['hostname']
else:
hostname = node.hostname
actions = {
'systemd-reload': {
'command': 'systemctl daemon-reload',
'cascade_skip': False,
'triggered': True,
'needed_by': {
'svc_systemd:',
},
},
'systemd-hostname': {
2020-09-27 14:46:54 +00:00
'command': 'hostnamectl set-hostname {}'.format(hostname),
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(hostname),
# Provided by 'hostname' bundle
'needs': {
'file:/etc/hosts',
},
},
}