# Do not manually edit this file.
# Managed by ansible role tripleo_timemaster

{% set ptp_ifaces = tripleo_timemaster_ptpinterfaces.split(',') %}
{% set ptp_dict = {} %}
{% for ptp in ptp_ifaces %}
{% if ptp.split(':')[0] not in ptp_dict %}
{% set _ = ptp_dict.update({ptp.split(':')[0]: []}) %}
{% endif %}
{% set _ = ptp_dict[ptp.split(':')[0]].append(ptp.split(':')[1]) %}
{% endfor %}
{% for domain, nic_list in ptp_dict.items() %}
[ptp_domain {{ domain }}]
interfaces {% for nic in nic_list %}
{{ nic }}{% if not loop.last %} {% endif %}
{% endfor %}

{% endfor %}

[timemaster]
ntp_program chronyd

[chrony.conf]
#include /etc/chrony.conf
{% for server in tripleo_timemaster_ntp_servers -%}
{% if server is mapping %}
server {{ server.server_host }} {{ server.server_settings }}
{% else %}
server {{ server }} {{ tripleo_timemaster_global_server_settings|default('') }}
{% endif %}
{% endfor -%}

{% for pool in tripleo_timemaster_ntp_pools -%}
{% if pool is mapping %}
pool {{ pool.pool_host }} {{ pool.pool_settings }}
{% else %}
pool {{ pool }} {{ tripleo_timemaster_global_pool_settings|default('') }}
{% endif %}
{% endfor -%}

{% for peer in tripleo_timemaster_ntp_peers -%}
{% if peer is mapping %}
peer {{ peer.peer_host }} {{ peer.peer_settings }}
{% else %}
peer {{ peer }} {{ tripleo_timemaster_global_peer_settings|default('') }}
{% endif %}
{% endfor -%}

{% if tripleo_timemaster_bind_addresses is defined and tripleo_timemaster_bind_addresses|length > 0 -%}
{% for bind_addr in tripleo_timemaster_bind_addresses %}
bindcmdaddress {{ bind_addr }}
{% endfor %}
{% endif -%}

{% if tripleo_timemaster_acl_rules is defined and tripleo_timemaster_acl_rules|length > 0 -%}
{{ tripleo_timemaster_acl_rules|join("\n") }}
{% endif -%}

{% if tripleo_timemaster_rtc_settings is defined -%}
{{ tripleo_timemaster_rtc_settings }}
{% endif -%}

{% if tripleo_timemaster_makestep is defined -%}
makestep {{ tripleo_timemaster_makestep }}{{ '\n' }}
{% endif -%}

{% if tripleo_timemaster_extra_options -%}
{{ tripleo_timemaster_extra_options|join("\n") }}
{% endif -%}

[ntp.conf]
includefile /etc/ntp.conf

[ptp4l.conf]
#includefile /etc/ptp4l.conf
network_transport {{ tripleo_timemaster_ptptransport }}

[chronyd]
path /usr/sbin/chronyd

[ntpd]
path /usr/sbin/ntpd
options -u ntp:ntp -g

[phc2sys]
path /usr/sbin/phc2sys
#options -w

[ptp4l]
path /usr/sbin/ptp4l
