--- - name: Clean up ntp apt: state: absent name: ntp purge: true register: apt_result retries: 3 until: apt_result is succeeded when: "'ntp_server' not in group_names" - name: Install systemd-timesyncd apt: name: systemd-timesyncd update_cache: true install_recommends: false register: apt_result retries: 3 until: apt_result is succeeded when: - "'ntp_server' not in group_names" - name: Configure NTP template: src: systemd/timesyncd.conf.j2 dest: /etc/systemd/timesyncd.conf notify: Restart systemd-timesyncd when: "'ntp_server' not in group_names"