main.yml 272 B

1234567
  1. ---
  2. - name: ensure systemd NTP client is enabled
  3. shell: "timedatectl | grep 'NTP enabled: yes' || timedatectl set-ntp 1"
  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"