bundles/systemd: also manage systemd-timesyncd
This commit is contained in:
parent
5dc60eb24e
commit
d6da47fc1e
2 changed files with 83 additions and 44 deletions
22
bundles/systemd/files/timesyncd.conf
Normal file
22
bundles/systemd/files/timesyncd.conf
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# This file is part of systemd.
|
||||||
|
#
|
||||||
|
# systemd is free software; you can redistribute it and/or modify it under the
|
||||||
|
# terms of the GNU Lesser General Public License as published by the Free
|
||||||
|
# Software Foundation; either version 2.1 of the License, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# Entries in this file show the compile time defaults. Local configuration
|
||||||
|
# should be created by either modifying this file, or by creating "drop-ins" in
|
||||||
|
# the timesyncd.conf.d/ subdirectory. The latter is generally recommended.
|
||||||
|
# Defaults can be restored by simply deleting this file and all drop-ins.
|
||||||
|
#
|
||||||
|
# See timesyncd.conf(5) for details.
|
||||||
|
|
||||||
|
[Time]
|
||||||
|
NTP=de.pool.ntp.org
|
||||||
|
FallbackNTP=pool.ntp.org
|
||||||
|
#RootDistanceMaxSec=5
|
||||||
|
PollIntervalMinSec=32
|
||||||
|
PollIntervalMaxSec=2048
|
||||||
|
ConnectionRetrySec=10
|
||||||
|
SaveIntervalSec=30
|
|
@ -1,34 +1,33 @@
|
||||||
timezone = node.metadata.get('timezone', 'UTC')
|
timezone = node.metadata.get('timezone', 'UTC')
|
||||||
|
|
||||||
actions = {
|
actions['systemd-reload'] = {
|
||||||
'systemd-reload': {
|
|
||||||
'command': 'systemctl daemon-reload',
|
'command': 'systemctl daemon-reload',
|
||||||
'cascade_skip': False,
|
'cascade_skip': False,
|
||||||
'triggered': True,
|
'triggered': True,
|
||||||
'needed_by': {
|
'needed_by': {
|
||||||
'svc_systemd:',
|
'svc_systemd:',
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
'systemd-hostname': {
|
|
||||||
|
actions['systemd-hostname'] = {
|
||||||
'command': 'hostnamectl set-hostname {}'.format(node.metadata['hostname']),
|
'command': 'hostnamectl set-hostname {}'.format(node.metadata['hostname']),
|
||||||
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(node.metadata['hostname']),
|
'unless': '[ "$(hostnamectl --static)" = "{}" ]'.format(node.metadata['hostname']),
|
||||||
# Provided by bundle:basic
|
# Provided by bundle:basic
|
||||||
'needs': {
|
'needs': {
|
||||||
'file:/etc/hosts',
|
'file:/etc/hosts',
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
'systemd-timezone': {
|
|
||||||
'command': 'timedatectl set-timezone {}'.format(timezone),
|
directories['/usr/local/lib/systemd/system'] = {
|
||||||
'unless': 'timedatectl status | grep -Fi \'time zone\' | grep -i \'{}\''.format(timezone.lower()),
|
'purge': True,
|
||||||
},
|
'triggers': {
|
||||||
'systemd-enable-ntp': {
|
'action:systemd-reload',
|
||||||
'command': 'timedatectl set-ntp true',
|
|
||||||
'unless': 'timedatectl status | grep -Fi \'ntp service\' | grep -i \'active\'',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
files = {
|
|
||||||
'/etc/systemd/journald.conf': {
|
# journal settings
|
||||||
|
files['/etc/systemd/journald.conf'] = {
|
||||||
'content_type': 'mako',
|
'content_type': 'mako',
|
||||||
'context': {
|
'context': {
|
||||||
'journal': node.metadata.get('systemd/journal', {}),
|
'journal': node.metadata.get('systemd/journal', {}),
|
||||||
|
@ -36,22 +35,40 @@ files = {
|
||||||
'triggers': {
|
'triggers': {
|
||||||
'svc_systemd:systemd-journald:restart',
|
'svc_systemd:systemd-journald:restart',
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
directories = {
|
svc_systemd['systemd-journald'] = {
|
||||||
'/usr/local/lib/systemd/system': {
|
|
||||||
'purge': True,
|
|
||||||
'triggers': {
|
|
||||||
'action:systemd-reload',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
svc_systemd = {
|
|
||||||
'systemd-journald': {
|
|
||||||
'needs': {
|
'needs': {
|
||||||
'file:/etc/systemd/journald.conf',
|
'file:/etc/systemd/journald.conf',
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
# NTP
|
||||||
|
files['/etc/systemd/timesyncd.conf'] = {
|
||||||
|
'triggers': {
|
||||||
|
'svc_systemd:systemd-timesyncd:restart',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue