--- # Hosts running Ubuntu 16.04+ and Debian 9+ use systemd init system and should # use timedatectl as a network time client instead of the standalone ntp client. # Alpine can use chrony. - name: Set timezone when: timezone is defined and ansible_service_mgr == 'systemd' command: /usr/bin/timedatectl set-timezone {{ timezone }} tags: timezone - name: Start and enable systemd's NTP client when: ansible_service_mgr == 'systemd' systemd: name=systemd-timesyncd state=started enabled=yes - name: Uninstall ntp on modern Ubuntu/Debian apt: name=ntp state=absent update_cache=yes when: ansible_service_mgr == 'systemd' - name: Install chronyd on Alpine apt: name=chrony state=present when: ansible_distribution == 'Alpine' # vim: set ts=2 sw=2: