include: | include: | ||||
- {{ sls_package_install }} | - {{ sls_package_install }} | ||||
{%- if chrony.confd is string %} | |||||
chrony-config-conf.d: | |||||
file.directory: | |||||
- name: {{ chrony.confd }} | |||||
- clean: True | |||||
- require: | |||||
- sls: {{ sls_package_install }} | |||||
- file: chrony-config-file-file-managed | |||||
- file: chrony-config-file-pool-file-managed | |||||
{%- endif %} | |||||
chrony-config-file-file-managed: | chrony-config-file-file-managed: | ||||
file.managed: | file.managed: | ||||
- name: {{ chrony.config }} | - name: {{ chrony.config }} | ||||
chrony: {{ chrony|json }} | chrony: {{ chrony|json }} | ||||
- require: | - require: | ||||
- sls: {{ sls_package_install }} | - sls: {{ sls_package_install }} | ||||
chrony-config-file-pool-file-managed: | |||||
file.managed: | |||||
- name: {{ chrony.confd }}/pool.conf | |||||
- create: False | |||||
- replace: False | |||||
- require: | |||||
- sls: {{ sls_package_install }} |
service: | service: | ||||
name: chronyd | name: chronyd | ||||
config: /etc/chrony.conf | config: /etc/chrony.conf | ||||
confd: false | |||||
ntpservers: | ntpservers: | ||||
- '0.us.pool.ntp.org' | - '0.us.pool.ntp.org' | ||||
- '1.us.pool.ntp.org' | - '1.us.pool.ntp.org' |
- 'maxdistance 6' | - 'maxdistance 6' | ||||
- 'logchange 0.1' | - 'logchange 0.1' | ||||
Suse: | |||||
confd: /etc/chrony.d | |||||
Gentoo: | Gentoo: | ||||
package: net-misc/chrony | package: net-misc/chrony | ||||
config: /etc/chrony/chrony.conf | config: /etc/chrony/chrony.conf |
keyfile = 'keyfile ' | keyfile = 'keyfile ' | ||||
driftfile = '/var/lib/chrony/' | driftfile = '/var/lib/chrony/' | ||||
logdir = 'logdir /var/log/chrony' | logdir = 'logdir /var/log/chrony' | ||||
confd = nil | |||||
case platform[:name] | case platform[:name] | ||||
when 'debian', 'ubuntu' | when 'debian', 'ubuntu' | ||||
config_file = '/etc/chrony/chrony.conf' | config_file = '/etc/chrony/chrony.conf' | ||||
config_file = '/etc/chrony/chrony.conf' | config_file = '/etc/chrony/chrony.conf' | ||||
keyfile += '/etc/chrony.keys' | keyfile += '/etc/chrony.keys' | ||||
driftfile += 'drift' | driftfile += 'drift' | ||||
when 'suse' | |||||
config_file = '/etc/chrony.conf' | |||||
keyfile += '/etc/chrony.keys' | |||||
driftfile += 'drift' | |||||
confd = '/etc/chrony.d' | |||||
else | else | ||||
config_file = '/etc/chrony.conf' | config_file = '/etc/chrony.conf' | ||||
keyfile += '/etc/chrony.keys' | keyfile += '/etc/chrony.keys' | ||||
its('content') { should include 'pool 0.debian.pool.ntp.org iburst' } | its('content') { should include 'pool 0.debian.pool.ntp.org iburst' } | ||||
its('content') { should include 'pool 1.centos.pool.ntp.org' } | its('content') { should include 'pool 1.centos.pool.ntp.org' } | ||||
end | end | ||||
if !confd.nil? | |||||
describe directory(confd) do | |||||
its('size') { should be 0 } | |||||
end | |||||
end | |||||
end | end |