Kapitel 05: Playbook chrony(ntp) für apt/yum/zypper
This commit is contained in:
parent
394c6825c5
commit
c35c604873
17
05/chrony_apt.yml
Normal file
17
05/chrony_apt.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
- hosts: apt
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install Chrony
|
||||||
|
ansible.builtin.apt: name=chrony state=latest
|
||||||
|
|
||||||
|
- name: Copy config file
|
||||||
|
ansible.builtin.copy: src=chrony.conf dest=/etc/chrony/chrony.conf mode=0644 owner=root group=root backup=yes
|
||||||
|
|
||||||
|
- name: Restart Chrony with new config
|
||||||
|
ansible.builtin.service: name=chrony state=restarted
|
||||||
|
|
||||||
|
- name: Start Chrony at boot
|
||||||
|
ansible.builtin.service: name=chrony enabled=yes
|
||||||
|
|
||||||
|
|
16
05/chrony_yum.yml
Normal file
16
05/chrony_yum.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
- hosts: yum
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install Chrony
|
||||||
|
ansible.builtin.yum: name=chrony state=latest
|
||||||
|
|
||||||
|
- name: Copy config file
|
||||||
|
ansible.builtin.copy: src=chrony.conf dest=/etc/chrony.conf mode=0644 owner=root group=root backup=yes
|
||||||
|
|
||||||
|
- name: Restart Chrony with new config
|
||||||
|
ansible.builtin.service: name=chronyd state=restarted
|
||||||
|
|
||||||
|
- name: Start Chrony at boot
|
||||||
|
ansible.builtin.service: name=chronyd enabled=yes
|
||||||
|
|
22
05/chrony_zypper_mit_python-xml_fuer_Py2.yml
Normal file
22
05/chrony_zypper_mit_python-xml_fuer_Py2.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
- hosts: zypper
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: "zypper module dependency (Py2 only)"
|
||||||
|
ansible.builtin.command: zypper -n install python-xml
|
||||||
|
args:
|
||||||
|
creates: /usr/lib*/python2.*/xml/dom/minidom.py
|
||||||
|
when: ansible_python.version.major|default(2) == 2
|
||||||
|
|
||||||
|
- name: Install Chrony
|
||||||
|
community.general.zypper: name=chrony state=latest
|
||||||
|
|
||||||
|
- name: Copy config file
|
||||||
|
ansible.builtin.copy: src=chrony.conf dest=/etc/chrony.conf mode=0644 owner=root group=root backup=yes
|
||||||
|
|
||||||
|
- name: Restart Chrony with new config
|
||||||
|
ansible.builtin.service: name=chronyd state=restarted
|
||||||
|
|
||||||
|
- name: Start Chrony at boot
|
||||||
|
ansible.builtin.service: name=chronyd enabled=yes
|
||||||
|
|
22
05/old.ntp/ntp.conf
Normal file
22
05/old.ntp/ntp.conf
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
pool 0.debian.pool.ntp.org iburst
|
||||||
|
pool 1.debian.pool.ntp.org iburst
|
||||||
|
pool 2.debian.pool.ntp.org iburst
|
||||||
|
pool 3.debian.pool.ntp.org iburst
|
||||||
|
|
||||||
|
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
|
||||||
|
|
17
05/old.ntp/ntp_apt.yml
Normal file
17
05/old.ntp/ntp_apt.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
- hosts: apt
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install NTP
|
||||||
|
apt: name=ntp state=latest
|
||||||
|
|
||||||
|
- name: Copy ntp.conf
|
||||||
|
copy: src=ntp.conf dest=/etc/ntp.conf backup=yes
|
||||||
|
|
||||||
|
- name: Restart NTP
|
||||||
|
service: name=ntp state=restarted
|
||||||
|
|
||||||
|
- name: Enable NTP
|
||||||
|
service: name=ntp enabled=yes state=started
|
||||||
|
|
17
05/old.ntp/ntp_yum.yml
Normal file
17
05/old.ntp/ntp_yum.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
- hosts: yum
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install NTP
|
||||||
|
yum: name=ntp state=latest
|
||||||
|
|
||||||
|
- name: Copy ntp.conf
|
||||||
|
copy: src=ntp.conf dest=/etc/ntp.conf backup=yes
|
||||||
|
|
||||||
|
- name: Restart NTP
|
||||||
|
service: name=ntpd state=restarted
|
||||||
|
|
||||||
|
- name: Enable NTP
|
||||||
|
service: name=ntpd enabled=yes state=started
|
||||||
|
|
23
05/old.ntp/ntp_zypper.yml
Normal file
23
05/old.ntp/ntp_zypper.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
- hosts: zypper
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: "Python2: Zypper module dependency"
|
||||||
|
command: zypper -n install python-xml
|
||||||
|
args:
|
||||||
|
creates: /usr/lib*/python2.*/xml/dom/minidom.py
|
||||||
|
when: ansible_python.version.major == "2"
|
||||||
|
|
||||||
|
- name: Install NTP
|
||||||
|
zypper: name=ntp state=latest
|
||||||
|
|
||||||
|
- name: Copy ntp.conf
|
||||||
|
copy: src=ntp.conf dest=/etc/ntp.conf backup=yes
|
||||||
|
|
||||||
|
- name: Restart NTP
|
||||||
|
service: name=ntpd state=restarted
|
||||||
|
|
||||||
|
- name: Enable NTP
|
||||||
|
service: name=ntpd enabled=yes state=started
|
||||||
|
|
Loading…
Reference in a new issue