Kapitel 10: Chrony mit Handler

This commit is contained in:
Sven Velt 2024-09-19 09:36:03 +02:00
parent c2e7716fe1
commit e5a5d1c94c
4 changed files with 57 additions and 0 deletions

1
10/chrony.conf.j2 Symbolic link
View file

@ -0,0 +1 @@
../05/chrony.conf.j2

24
10/chrony_mit_handler.yml Normal file
View file

@ -0,0 +1,24 @@
---
- hosts: all
tasks:
- name: Install Chrony
package: name=chrony state=latest
notify: Restart Chrony
- name: Show pools
debug: var=chrony_pools
- name: Template config file
template: "src=chrony.conf.j2 dest='{{ chrony_config_path }}' mode=0644 owner=root group=root backup=yes"
notify: Restart Chrony
- name: Enable Chrony at boot
service: "name={{ chrony_service_name }} enabled=yes"
handlers:
- name: Restart Chrony
service: "name='{{ chrony_service_name }}' state=restarted"

1
10/old.ntp/ntp.conf.j2 Symbolic link
View file

@ -0,0 +1 @@
../../05/old.ntp/ntp.conf.j2

View file

@ -0,0 +1,31 @@
---
- hosts: all
tasks:
- name: Install NTP
package:
name: ntp
state: latest
- name: Debug
debug: var=ntp_servers
- name: Copy ntp.conf
template:
src: ntp.conf.j2
dest: /etc/ntp.conf
backup: yes
notify: Restart NTP
- name: Enable NTP
service:
name: "{{ ntp_service_name }}"
enabled: yes
state: started
handlers:
- name: Restart NTP
service: "name={{ ntp_service_name }} state=\"restarted\""