2020-09-27 14:46:54 +00:00
|
|
|
if 'hostname' in node.metadata:
|
|
|
|
hostname = node.metadata['hostname']
|
|
|
|
else:
|
|
|
|
hostname = node.hostname
|
|
|
|
|
2020-03-21 11:31:56 +00:00
|
|
|
actions = {
|
|
|
|
'systemd-reload': {
|
2020-09-22 16:11:09 +00:00
|
|
|
'command': 'systemctl daemon-reload',
|
2020-03-21 11:31:56 +00:00
|
|
|
'cascade_skip': False,
|
|
|
|
'triggered': True,
|
2020-03-27 12:46:10 +00:00
|
|
|
'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),
|
2020-03-27 12:46:10 +00:00
|
|
|
# Provided by 'hostname' bundle
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/hosts',
|
|
|
|
},
|
2020-03-21 11:31:56 +00:00
|
|
|
},
|
|
|
|
}
|