Kapitel 05: chrony mit Variablen
This commit is contained in:
parent
c35c604873
commit
b611b25902
8
05/chrony.conf.j2
Normal file
8
05/chrony.conf.j2
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
# Server/Pool-Platzhater
|
||||||
|
{% for pool in chrony_pools %}pool {{ pool }} iburst
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
makestep 1 3
|
||||||
|
rtcsync
|
||||||
|
|
20
05/chrony.yml
Normal file
20
05/chrony.yml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install Chrony
|
||||||
|
ansible.builtin.package: name=chrony state=latest
|
||||||
|
|
||||||
|
- name: Show pools
|
||||||
|
ansible.builtin.debug: var=chrony_pools
|
||||||
|
|
||||||
|
- name: Template config file
|
||||||
|
ansible.builtin.template: "src=chrony.conf.j2 dest='{{ chrony_config_path }}' mode=0644 owner=root group=root backup=yes"
|
||||||
|
|
||||||
|
- name: Restart Chrony with new config
|
||||||
|
ansible.builtin.service: "name='{{ chrony_service_name }}' state=restarted"
|
||||||
|
|
||||||
|
- name: Enable Chrony at boot
|
||||||
|
ansible.builtin.service: "name={{ chrony_service_name }} state=started enabled=yes"
|
||||||
|
|
20
05/chrony_mit_vars.yml
Normal file
20
05/chrony_mit_vars.yml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
vars:
|
||||||
|
chrony_pools: [0.de.pool.ntp.org, 1.de.pool.ntp.org, 2.de.pool.ntp.org]
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install Chrony
|
||||||
|
ansible.builtin.package: name=chrony state=latest
|
||||||
|
|
||||||
|
- name: Template config file
|
||||||
|
ansible.builtin.template: "src=chrony.conf.j2 dest='{{ chrony_config_path }}' mode=0644 owner=root group=root backup=yes"
|
||||||
|
|
||||||
|
- name: Restart Chrony with new config
|
||||||
|
ansible.builtin.service: "name='{{ chrony_service_name }}' state=restarted"
|
||||||
|
|
||||||
|
- name: Enable Chrony at boot
|
||||||
|
ansible.builtin.service: "name={{ chrony_service_name }} state=started enabled=yes"
|
||||||
|
|
7
05/debug.yml
Normal file
7
05/debug.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
- hosts:
|
||||||
|
- localhost
|
||||||
|
tasks:
|
||||||
|
- ansible.builtin.debug: "msg='IP: {{ ansible_default_ipv4.address}} - GW: {{ ansible_default_ipv4.gateway }}'"
|
||||||
|
- ansible.builtin.debug: var=ansible_default_ipv4
|
||||||
|
|
21
05/old.ntp/ntp.conf.j2
Normal file
21
05/old.ntp/ntp.conf.j2
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
driftfile /var/lib/ntp/ntp.drift
|
||||||
|
|
||||||
|
leapfile /usr/share/zoneinfo/leap-seconds.list
|
||||||
|
|
||||||
|
statistics loopstats peerstats clockstats
|
||||||
|
filegen loopstats file loopstats type day enable
|
||||||
|
filegen peerstats file peerstats type day enable
|
||||||
|
filegen clockstats file clockstats type day enable
|
||||||
|
|
||||||
|
{% for server in ntp_servers %}pool {{ server }} iburst
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
restrict -4 default kod notrap nomodify nopeer noquery limited
|
||||||
|
restrict -6 default kod notrap nomodify nopeer noquery limited
|
||||||
|
|
||||||
|
restrict 127.0.0.1
|
||||||
|
restrict ::1
|
||||||
|
|
||||||
|
restrict source notrap nomodify noquery
|
||||||
|
|
20
05/old.ntp/ntp.yml
Normal file
20
05/old.ntp/ntp.yml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install NTP
|
||||||
|
package: name=ntp state=latest
|
||||||
|
|
||||||
|
- name: Debug
|
||||||
|
debug: var=ntp_servers
|
||||||
|
|
||||||
|
- name: Template ntp.conf
|
||||||
|
template: src=ntp.conf.j2 dest=/etc/ntp.conf backup=yes
|
||||||
|
|
||||||
|
- name: Restart NTP
|
||||||
|
service: "name={{ ntp_service_name }} state=\"restarted\""
|
||||||
|
|
||||||
|
- name: Enable NTP
|
||||||
|
service: 'name="{{ ntp_service_name }}" enabled=yes state=started'
|
||||||
|
|
3
group_vars/all/chrony.yml
Normal file
3
group_vars/all/chrony.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
chrony_config_path: /etc/chrony.conf
|
||||||
|
chrony_service_name: chronyd
|
2
group_vars/apk/chrony.yml
Normal file
2
group_vars/apk/chrony.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
chrony_config_path: /etc/chrony/chrony.conf
|
4
group_vars/apt/chrony.yml
Normal file
4
group_vars/apt/chrony.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
chrony_config_path: /etc/chrony/chrony.conf
|
||||||
|
chrony_service_name: chrony
|
||||||
|
|
6
group_vars/centos.yml
Normal file
6
group_vars/centos.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
chrony_pools:
|
||||||
|
- 0.centos.pool.ntp.org
|
||||||
|
- 1.centos.pool.ntp.org
|
||||||
|
- 2.centos.pool.ntp.org
|
||||||
|
|
7
group_vars/debian.yml
Normal file
7
group_vars/debian.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
chrony_pools:
|
||||||
|
- 0.debian.pool.ntp.org
|
||||||
|
- 1.debian.pool.ntp.org
|
||||||
|
- 2.debian.pool.ntp.org
|
||||||
|
- 3.debian.pool.ntp.org
|
||||||
|
|
11
group_vars/opensuse.yml
Normal file
11
group_vars/opensuse.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
chrony_pools:
|
||||||
|
- 2.de.pool.ntp.org
|
||||||
|
- 3.de.pool.ntp.org
|
||||||
|
- 2.at.pool.ntp.org
|
||||||
|
- 3.at.pool.ntp.org
|
||||||
|
- 2.ch.pool.ntp.org
|
||||||
|
- 3.ch.pool.ntp.org
|
||||||
|
- 2.uk.pool.ntp.org
|
||||||
|
- 3.uk.pool.ntp.org
|
||||||
|
|
7
group_vars/ubuntu/chrony.yml
Normal file
7
group_vars/ubuntu/chrony.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
chrony_pools:
|
||||||
|
- 0.ubuntu.pool.ntp.org
|
||||||
|
- 1.ubuntu.pool.ntp.org
|
||||||
|
- 2.ubuntu.pool.ntp.org
|
||||||
|
- 3.ubuntu.pool.ntp.org
|
||||||
|
|
4
host_vars/tn00-suse-t.yml
Normal file
4
host_vars/tn00-suse-t.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
chrony_pools:
|
||||||
|
- ntp.meinberg.de
|
||||||
|
|
7
host_vars/tn00-void.yml
Normal file
7
host_vars/tn00-void.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
chrony_pools:
|
||||||
|
- ntp.meinberg.de
|
||||||
|
- ptbtime1.ptb.de
|
||||||
|
- ptbtime2.ptb.de
|
||||||
|
- ptbtime3.ptb.de
|
||||||
|
|
Loading…
Reference in a new issue