diff --git a/tasks/main.yml b/tasks/main.yml index a868929..462f6cc 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: '{{ cfg.regexp }}' + line: '{{ cfg.line }}' loop: - { 'regexp': '^#*NTP=.*$', 'line': 'NTP={{ ntp | default("") | join(" ") }}'} - { 'regexp': '^#*FallbackNTP=.*$', 'line': 'FallbackNTP={{ fallback_ntp | default("") | join(" ") }}'} + loop_control: + loop_var: cfg - name: "stop and disable chronyd" when: ansible_facts.services['chrony.service'] is defined