---
- name: Determine if chrony is installed
  command: rpm -q chrony
  failed_when: false
  register: chrony_installed

- name: Install ntp package
  package: name=ntp state=present
  when:
    - openshift_clock_enabled | bool
    - chrony_installed.rc != 0
  register: result
  until: result is succeeded

- name: Start and enable ntpd/chronyd
  command: timedatectl set-ntp true
  when: openshift_clock_enabled | bool
