main.yml 409 B

1234567891011121314
  1. ---
  2. - name: ensure ntp daemons are absent
  3. apt: name={{ item }} state=absent purge=yes
  4. with_items:
  5. - ntp
  6. - chrony
  7. - openntpd
  8. - name: ensure systemd NTP client is enabled
  9. shell: "timedatectl | grep 'NTP enabled: yes' || timedatectl set-ntp 1"
  10. register: ntp_shell_result
  11. changed_when: "ntp_shell_result.stdout == '' and ntp_shell_result.rc == 0"
  12. failed_when: "ntp_shell_result.rc != 0"