Browse Source

Merge pull request #37 from apatard/master

feat(config): Allow differents options for server and pool
tags/v1.3.0
Imran Iqbal 3 years ago
parent
commit
4ab56405d6
No account linked to committer's email address
3 changed files with 18 additions and 4 deletions
  1. +8
    -0
      chrony/files/default/chrony.conf.jinja
  2. +6
    -4
      pillar.example
  3. +4
    -0
      test/integration/default/controls/config_spec.rb

+ 8
- 0
chrony/files/default/chrony.conf.jinja View File



{%- if chrony.ntpservers is defined %} {%- if chrony.ntpservers is defined %}
{% for server in chrony.ntpservers -%} {% for server in chrony.ntpservers -%}
{% if server is mapping %}
server {{ server.name }} {{ server.options | default(chrony.options) }}
{% else %}
server {{ server }} {{ chrony.options }} server {{ server }} {{ chrony.options }}
{% endif %}
{% endfor %} {% endfor %}
{%- endif %} {%- endif %}


{%- if chrony.pool is defined %} {%- if chrony.pool is defined %}
{% for pool in chrony.pool -%} {% for pool in chrony.pool -%}
{% if pool is mapping %}
pool {{ pool.name }} {{ pool.options | default(chrony.options) }}
{% else %}
pool {{ pool }} {{ chrony.options }} pool {{ pool }} {{ chrony.options }}
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}



+ 6
- 4
pillar.example View File

--- ---
chrony: chrony:
ntpservers: ntpservers:
- '0.debian.pool.ntp.org'
- '1.centos.pool.ntp.org'
- name: '0.debian.pool.ntp.org'
options: iburst
- name: '1.centos.pool.ntp.org'
- '2.arch.pool.ntp.org' - '2.arch.pool.ntp.org'
- '3.gentoo.pool.ntp.org' - '3.gentoo.pool.ntp.org'
pool: pool:
- '0.debian.pool.ntp.org'
- '1.centos.pool.ntp.org'
- name: '0.debian.pool.ntp.org'
options: iburst
- name: '1.centos.pool.ntp.org'
- '2.arch.pool.ntp.org' - '2.arch.pool.ntp.org'
- '3.gentoo.pool.ntp.org' - '3.gentoo.pool.ntp.org'
allow: allow:

+ 4
- 0
test/integration/default/controls/config_spec.rb View File

its('content') { should include keyfile } its('content') { should include keyfile }
its('content') { should include driftfile } its('content') { should include driftfile }
its('content') { should include logdir } its('content') { should include logdir }
its('content') { should include 'server 0.debian.pool.ntp.org iburst' }
its('content') { should include 'server 1.centos.pool.ntp.org' }
its('content') { should include 'pool 0.debian.pool.ntp.org iburst' }
its('content') { should include 'pool 1.centos.pool.ntp.org' }
end end
end end

Loading…
Cancel
Save