From d83d49e61154235b2d51d96cca30d0cbcdb9a169 Mon Sep 17 00:00:00 2001 From: 135 Date: Wed, 6 Sep 2023 22:21:59 +0300 Subject: [PATCH] WIP. notice fixes --- handlers/main.yml | 4 +++- tasks/main.yml | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 4b186f4..1fe92a2 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,12 +1,14 @@ --- # handlers file for systemd-timesyncd - name: "restart systemd-timesyncd" + become: true service: name: systemd-timesyncd.service state: restarted listen: systemd-timesyncd configuration changed - name: "write adjtime" + become: true command: hwclock --systohc when: (ansible_virtualization_role == "host" or ansible_virtualization_role == "NA") and write_hwclock_on_change - listen: systemd-timesyncd configuration changed \ No newline at end of file + listen: systemd-timesyncd configuration changed diff --git a/tasks/main.yml b/tasks/main.yml index a868929..d90035a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,11 +17,13 @@ - name: "configure systemd-timesyncd" lineinfile: path: /etc/systemd/timesyncd.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' + regexp: '{{ titem.regexp }}' + line: '{{ titem.line }}' loop: - { 'regexp': '^#*NTP=.*$', 'line': 'NTP={{ ntp | default("") | join(" ") }}'} - { 'regexp': '^#*FallbackNTP=.*$', 'line': 'FallbackNTP={{ fallback_ntp | default("") | join(" ") }}'} + loop_control: + loop_var: titem - name: "stop and disable chronyd" when: ansible_facts.services['chrony.service'] is defined @@ -37,4 +39,5 @@ enabled: yes state: started masked: no - notify: systemd-timesyncd configuration changed + become: true + notify: systemd-timesyncd configuration changed \ No newline at end of file