---

- block:
  - name: install ntp
    apt:
      name: ntp
      state: present
      update_cache: yes
      cache_valid_time: 3600

  - name: configure ntp
    copy:
      src: ntp.conf
      dest: /etc/ntp.conf
      owner: root
      group: root
      mode: "0644"

  - name: stop ntp
    service:
      name: ntp
      state: stopped

  - name: manually force sync time and update hardware clock
    shell: "ntpdate fos-dc01.zooxlabs.com;hwclock -w"

  - name: start/enable ntp
    service:
      name: ntp
      state: restarted
      enabled: yes

  become: yes
