--- - name: Check selected timesync daemon assert: that: - timesync_daemon in [ "busybox-ntp", "chrony", "ntp", "timesyncd" ] fail_msg: '{{ timesync_daemon|default("No daemon") }} not supported' success_msg: 'Found supported timesync service »{{ timesync_daemon }}«' - name: Change daemon from ntp to busybox-ntp on Alpine set_fact: timesync_daemon: "busybox-ntp" changed_when: True when: timesync_daemon == "ntp" and ansible_os_family|lower == "alpine" - name: Include each network variables if there is no host variable include_vars: "{{ timesync_varfile_network }}" vars: timesync_varfile_network: "vars/timesync_{{ ansible_default_ipv4.network }}.yml" when: ansible_default_ipv4 and timesync_varfile_network is file and (timesync_servers|default(False) == False and timesync_pools|default(False) == False) - name: "Set NTP »pools« for machines without default gateway" set_fact: timesync_pools: "{{ timesync_default_pools }}" timesync_servers: "{{ timesync_default_servers }}" when: timesync_servers|default(False) == False and timesync_pools|default(False) == False - name: Include OS dependent variables include_vars: "{{ item }}" with_first_found: - "os_{{ (ansible_os_family|default('Not-Available')|lower).split(' ')[0] }}.yml" - "os_{{ (ansible_lsb.id|default('Not-Available')|lower).split(' ')[0] }}.yml" - "os_default.yml" - name: Disable VMware timesync shell: 'vmware-toolbox-cmd timesync disable' changed_when: False when: ansible_virtualization_type|lower == "vmware" - include_tasks: "timesync_{{ timesync_daemon }}.yml"