main.yml 417 B

1234567891011121314
  1. ---
  2. - name: ensure systemd NTP client is disabled
  3. shell: "timedatectl | grep 'NTP enabled: no' || timedatectl set-ntp 0"
  4. register: ntp_shell_result
  5. changed_when: "ntp_shell_result.stdout == '' and ntp_shell_result.rc == 0"
  6. failed_when: "ntp_shell_result.rc != 0"
  7. - name: Ensure ntp is installed
  8. apt: name=ntp
  9. - name: Install ntp.conf
  10. template: src=ntp.conf.j2 dest=/etc/ntp.conf
  11. notify: Restart ntpd