2021-02-18 16:56:06 +00:00
|
|
|
timezone = node.metadata.get('timezone', 'UTC')
|
|
|
|
|
2022-12-16 14:10:52 +00:00
|
|
|
actions['systemd-reload'] = {
|
|
|
|
'command': 'systemctl daemon-reload',
|
|
|
|
'cascade_skip': False,
|
|
|
|
'triggered': True,
|
|
|
|
'needed_by': {
|
|
|
|
'svc_systemd:',
|
2020-03-27 12:46:10 +00:00
|
|
|
},
|
2022-12-16 14:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
actions['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',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
directories['/usr/local/lib/systemd/system'] = {
|
|
|
|
'purge': True,
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
2020-03-21 11:31:56 +00:00
|
|
|
},
|
2022-12-16 14:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# journal settings
|
|
|
|
files['/etc/systemd/journald.conf'] = {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'context': {
|
|
|
|
'journal': node.metadata.get('systemd/journal', {}),
|
2020-11-13 22:26:13 +00:00
|
|
|
},
|
2022-12-16 14:10:52 +00:00
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:systemd-journald:restart',
|
2020-11-13 22:26:13 +00:00
|
|
|
},
|
2020-03-21 11:31:56 +00:00
|
|
|
}
|
2020-12-12 09:39:57 +00:00
|
|
|
|
2022-12-16 14:10:52 +00:00
|
|
|
svc_systemd['systemd-journald'] = {
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/systemd/journald.conf',
|
2020-12-12 09:39:57 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-12-16 14:10:52 +00:00
|
|
|
# NTP
|
|
|
|
files['/etc/systemd/timesyncd.conf'] = {
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:systemd-timesyncd:restart',
|
2022-04-03 06:32:07 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-12-16 14:10:52 +00:00
|
|
|
actions['systemd-timezone'] = {
|
|
|
|
'command': 'timedatectl set-timezone {}'.format(timezone),
|
|
|
|
'unless': 'timedatectl status | grep -Fi \'time zone\' | grep -i \'{}\''.format(timezone.lower()),
|
|
|
|
'after': {
|
|
|
|
'svc_systemd:systemd-timesyncd',
|
2020-12-12 09:39:57 +00:00
|
|
|
},
|
|
|
|
}
|
2022-12-16 14:10:52 +00:00
|
|
|
|
|
|
|
actions['systemd-enable-ntp'] = {
|
|
|
|
'command': 'timedatectl set-ntp true',
|
|
|
|
'unless': 'timedatectl status | grep -Fi \'ntp service\' | grep -i \'active\'',
|
|
|
|
'after': {
|
|
|
|
'svc_systemd:systemd-timesyncd',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd['systemd-timesyncd'] = {
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/systemd/timesyncd.conf',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-12-16 15:14:26 +00:00
|
|
|
# monitoring
|
|
|
|
files['/usr/local/share/icinga/plugins/check_timesyncd_sync'] = {
|
|
|
|
'mode': '0755',
|
|
|
|
}
|