--- - name: ensure ntp daemons are absent apt: name={{ item }} state=absent purge=yes with_items: - ntp - chrony - openntpd - name: ensure systemd NTP client is enabled shell: "timedatectl | grep 'NTP enabled: yes' || timedatectl set-ntp 1" register: ntp_shell_result changed_when: "ntp_shell_result.stdout == '' and ntp_shell_result.rc == 0" failed_when: "ntp_shell_result.rc != 0"