@@ -18,15 +18,17 @@ leapfile /usr/share/zoneinfo/leap-seconds.list
18
18
{# Adding NTP servers. We need to know if we have some pools, to set proper
19
19
config -#}
20
20
{% set ns = namespace (is_pools =false ) %}
21
- {% for server in NTP_SERVER if NTP_SERVER [server ].admin_state != 'disabled' and
22
- NTP_SERVER [server ].resolve_as and
23
- NTP_SERVER [server ].association_type -%}
21
+ {% for server in NTP_SERVER if NTP_SERVER [server ].admin_state != 'disabled' -%}
24
22
{% set config = NTP_SERVER [server ] -%}
25
23
{# Server options -#}
26
24
{% set soptions = '' -%}
27
25
{# Server access control options -#}
28
26
{% set aoptions = '' -%}
29
27
28
+ {# Define defaults if not defined -#}
29
+ {% set association_type = config .association_type | d ('server' ) -%}
30
+ {% set resolve_as = config .resolve_as | d (server ) -%}
31
+
30
32
{# Authentication key -#}
31
33
{% if global .authentication == 'enabled' -%}
32
34
{% if config .key -%}
@@ -47,17 +49,15 @@ config -#}
47
49
{# Check if there are any pool configured. BTW it doesn't matter what was
48
50
configured as "resolve_as" for pools. If they were configured with FQDN they
49
51
must remain like that -#}
50
- {% set config_as = config .resolve_as -%}
51
- {% if config .association_type == 'pool' -%}
52
- {% set ns .is_pools = true -%}
53
- {% set config_as = server -%}
52
+ {% if association_type == 'pool' -%}
53
+ {% set resolve_as = server -%}
54
54
{% else -%}
55
55
{% set aoptions = aoptions ~ ' nopeer' -%}
56
56
{% endif -%}
57
57
58
- {{ config. association_type }} {{ config_as }}{{ soptions }}
58
+ {{ association_type }} {{ resolve_as }}{{ soptions }}
59
59
{% if global .server_role == 'disabled' %}
60
- restrict {{ config_as }} kod limited nomodify notrap noquery{{ aoptions }}
60
+ restrict {{ resolve_as }} kod limited nomodify notrap noquery{{ aoptions }}
61
61
{% endif %}
62
62
63
63
{% endfor -%}
0 commit comments