summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-11-27 21:24:53 +0100
committerChristian Pointner <equinox@spreadspace.org>2020-11-28 00:52:02 +0100
commit8ffeaf71efa7472ff8511c445aa8874b1b1f3613 (patch)
tree18132a977c42dd04a23ed61550df3a495d899f24 /roles
parentkubernetes/standalone: fix config hash annotation if role is included multipl... (diff)
move chrony role to core/ntp (WIP)
Diffstat (limited to 'roles')
-rw-r--r--roles/chrony/templates/chrony.conf.j255
-rw-r--r--roles/core/ntp/defaults/main.yml (renamed from roles/chrony/defaults/main.yml)18
-rw-r--r--roles/core/ntp/handlers/main.yml (renamed from roles/chrony/handlers/main.yml)0
-rw-r--r--roles/core/ntp/tasks/chrony.yml (renamed from roles/chrony/tasks/main.yml)0
-rw-r--r--roles/core/ntp/tasks/main.yml5
-rw-r--r--roles/core/ntp/templates/chrony.conf.j256
6 files changed, 72 insertions, 62 deletions
diff --git a/roles/chrony/templates/chrony.conf.j2 b/roles/chrony/templates/chrony.conf.j2
deleted file mode 100644
index 62d45315..00000000
--- a/roles/chrony/templates/chrony.conf.j2
+++ /dev/null
@@ -1,55 +0,0 @@
-### Global options
-
-cmdport 0
-keyfile /etc/chrony/chrony.keys
-driftfile /var/lib/chrony/chrony.drift
-logdir /var/log/chrony
-maxupdateskew 100.0
-rtcsync
-makestep 1 3
-
-{% if chrony_hwtimestamp_interfaces is defined %}
-{% for interface in chrony_hwtimestamp_interfaces %}
-hwtimestamp {{ interface.name }}{% if 'options' in interface %} {{ interface.options }}{% endif %}{{ '' }}
-{% endfor %}
-
-{% endif %}
-
-### Sources
-
-{% if chrony_source_servers is defined %}
-{% for server in chrony_source_servers %}
-server {{ server.name }}{% if 'options' in server %} {{ server.options }}{% endif %}{{ '' }}
-{% endfor %}
-
-{% endif %}
-{% if chrony_source_pools is defined %}
-{% for pool in chrony_source_pools %}
-pool {{ pool.name }}{% if 'options' in pool %} {{ pool.options }}{% endif %}{{ '' }}
-{% endfor %}
-
-{% endif %}
-{% if chrony_source_peers is defined %}
-{% for peer in chrony_source_peers %}
-peer {{ peer.name }}{% if 'options' in peer %} {{ peer.options }}{% endif %}{{ '' }}
-{% endfor %}
-
-{% endif %}
-
-
-{% if chrony_server is defined %}
-### Server
-
-{% for rule in chrony_server.allow | default([]) %}
-allow {{ rule }}
-{% endfor %}
-{% for rule in chrony_server.deny | default([]) %}
-deny {{ rule }}
-{% endfor %}
-{% if 'bindaddress' in chrony_server %}
-bindaddress {{ chrony_server.bind }}
-{% endif %}
-{% if 'port' in chrony_server %}
- port {{ chrony_server.port }}
-{% endif %}
-{% endif %}
diff --git a/roles/chrony/defaults/main.yml b/roles/core/ntp/defaults/main.yml
index bec79d5f..08e0ca80 100644
--- a/roles/chrony/defaults/main.yml
+++ b/roles/core/ntp/defaults/main.yml
@@ -1,23 +1,27 @@
---
-# chrony_source_servers:
+# ntp_variant: systemd-timesyncd
+# ntp_variant: chrony
+# ntp_variant: openntpd
+
+
+# ntp_client:
+# servers:
# - name: ntp.example.com
# options: iburst ...
-
-# chrony_source_pools:
+# pools:
# - name: pool.example.com
# options: iburst ....
-
-# chrony_source_peers:
+# peers:
# - name: peer.example.com
# options: iburst ....
-# chrony_hwtimestamp_interfaces:
+# ntp_hwtimestamp_interfaces:
# - name: "*"
# options: ....
-# chrony_server:
+# ntp_server:
# allow: []
# deny: []
# bind: 0.0.0.0
diff --git a/roles/chrony/handlers/main.yml b/roles/core/ntp/handlers/main.yml
index 08d878be..08d878be 100644
--- a/roles/chrony/handlers/main.yml
+++ b/roles/core/ntp/handlers/main.yml
diff --git a/roles/chrony/tasks/main.yml b/roles/core/ntp/tasks/chrony.yml
index d220af30..d220af30 100644
--- a/roles/chrony/tasks/main.yml
+++ b/roles/core/ntp/tasks/chrony.yml
diff --git a/roles/core/ntp/tasks/main.yml b/roles/core/ntp/tasks/main.yml
new file mode 100644
index 00000000..77f281ff
--- /dev/null
+++ b/roles/core/ntp/tasks/main.yml
@@ -0,0 +1,5 @@
+---
+## TODO: make this work on openbsd and debian/ubuntu
+- name: run ntp-variant specific tasks
+ when: ntp_variant is defined
+ include_tasks: "{{ ntp_variant }}.yml"
diff --git a/roles/core/ntp/templates/chrony.conf.j2 b/roles/core/ntp/templates/chrony.conf.j2
new file mode 100644
index 00000000..0bad9235
--- /dev/null
+++ b/roles/core/ntp/templates/chrony.conf.j2
@@ -0,0 +1,56 @@
+### Global options
+
+cmdport 0
+keyfile /etc/chrony/chrony.keys
+driftfile /var/lib/chrony/chrony.drift
+logdir /var/log/chrony
+maxupdateskew 100.0
+rtcsync
+makestep 1 3
+{% if ntp_hwtimestamp_interfaces is defined %}
+
+{% for interface in ntp_hwtimestamp_interfaces %}
+hwtimestamp {{ interface.name }}{% if 'options' in interface %} {{ interface.options }}{% endif %}{{ '' }}
+{% endfor %}
+{% endif %}
+{% if ntp_client is defined %}
+
+
+### Client
+{% if 'servers' in ntp_client %}
+
+{% for server in ntp_client.servers %}
+server {{ server.name }}{% if 'options' in server %} {{ server.options }}{% endif %}{{ '' }}
+{% endfor %}
+{% endif %}
+{% if 'pools' in ntp_client %}
+
+{% for pool in ntp_client.pools %}
+pool {{ pool.name }}{% if 'options' in pool %} {{ pool.options }}{% endif %}{{ '' }}
+{% endfor %}
+{% endif %}
+{% if 'peers' in ntp_client %}
+
+{% for peer in ntp_client.peers %}
+peer {{ peer.name }}{% if 'options' in peer %} {{ peer.options }}{% endif %}{{ '' }}
+{% endfor %}
+{% endif %}
+{% endif %}
+{% if ntp_server is defined %}
+
+
+### Server
+
+{% for rule in ntp_server.allow | default([]) %}
+allow {{ rule }}
+{% endfor %}
+{% for rule in ntp_server.deny | default([]) %}
+deny {{ rule }}
+{% endfor %}
+{% if 'bindaddress' in ntp_server %}
+bindaddress {{ ntp_server.bind }}
+{% endif %}
+{% if 'port' in ntp_server %}
+ port {{ ntp_server.port }}
+{% endif %}
+{% endif %}