WIP. notice fixes

This commit is contained in:
135
2023-09-06 22:21:59 +03:00
parent 22f3718c7e
commit d83d49e611
2 changed files with 9 additions and 4 deletions

View File

@@ -1,12 +1,14 @@
--- ---
# handlers file for systemd-timesyncd # handlers file for systemd-timesyncd
- name: "restart systemd-timesyncd" - name: "restart systemd-timesyncd"
become: true
service: service:
name: systemd-timesyncd.service name: systemd-timesyncd.service
state: restarted state: restarted
listen: systemd-timesyncd configuration changed listen: systemd-timesyncd configuration changed
- name: "write adjtime" - name: "write adjtime"
become: true
command: hwclock --systohc command: hwclock --systohc
when: (ansible_virtualization_role == "host" or ansible_virtualization_role == "NA") and write_hwclock_on_change when: (ansible_virtualization_role == "host" or ansible_virtualization_role == "NA") and write_hwclock_on_change
listen: systemd-timesyncd configuration changed listen: systemd-timesyncd configuration changed

View File

@@ -17,11 +17,13 @@
- name: "configure systemd-timesyncd" - name: "configure systemd-timesyncd"
lineinfile: lineinfile:
path: /etc/systemd/timesyncd.conf path: /etc/systemd/timesyncd.conf
regexp: '{{ item.regexp }}' regexp: '{{ titem.regexp }}'
line: '{{ item.line }}' line: '{{ titem.line }}'
loop: loop:
- { 'regexp': '^#*NTP=.*$', 'line': 'NTP={{ ntp | default("") | join(" ") }}'} - { 'regexp': '^#*NTP=.*$', 'line': 'NTP={{ ntp | default("") | join(" ") }}'}
- { 'regexp': '^#*FallbackNTP=.*$', 'line': 'FallbackNTP={{ fallback_ntp | default("") | join(" ") }}'} - { 'regexp': '^#*FallbackNTP=.*$', 'line': 'FallbackNTP={{ fallback_ntp | default("") | join(" ") }}'}
loop_control:
loop_var: titem
- name: "stop and disable chronyd" - name: "stop and disable chronyd"
when: ansible_facts.services['chrony.service'] is defined when: ansible_facts.services['chrony.service'] is defined
@@ -37,4 +39,5 @@
enabled: yes enabled: yes
state: started state: started
masked: no masked: no
notify: systemd-timesyncd configuration changed become: true
notify: systemd-timesyncd configuration changed