Kapitel 05: Chrony-Playbook je Packet Manager

This commit is contained in:
Sven Velt 2024-09-17 13:06:57 +02:00
parent 39d63b9616
commit bafd488247
8 changed files with 140 additions and 0 deletions

6
05/chrony.conf Normal file
View file

@ -0,0 +1,6 @@
pool 0.de.pool.ntp.org iburst
pool 2.de.pool.ntp.org iburst
makestep 1 3
rtcsync

17
05/chrony_apt.yml Normal file
View 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
View 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

View 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
View 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
View 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
View 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
View 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