123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- ---
- ### Create groups
- - hosts: all
- tasks:
- - group_by:
- key: "virt_{{ ansible_virtualization_role }}"
- - hosts: virt_guest
- gather_facts: no
- tasks:
- - group_by:
- key: "virtguest_{{ ansible_virtualization_type }}"
- # Debugging only
- - hosts: localhost
- gather_facts: no
- tasks:
- - debug:
- var: groups
- ### Hosts: Install/Configure NTP
- - hosts:
- - virt_NA
- - virt_host
- gather_facts: no
- roles:
- - timesync-enabled
- ### Container-Guests: Disable timesync!
- - hosts:
- - virtguest_docker
- - virtguest_openvz
- - virtguest_linuxvserver
- - virtguest_lxc
- - virtguest_lxc-libvirt
- - virtguest_rkt
- - virtguest_uml
- - virtguest_systemd-nspawn
- - virtguest_container-other
- gather_facts: no
- roles:
- - timesync-disabled
- ### KVM-Guests:
- # https://s19n.net/articles/2011/kvm_clock.html
- - hosts:
- - virtguest_kvm
- gather_facts: no
- pre_tasks:
- - command: cat /sys/devices/system/clocksource/clocksource0/current_clocksource
- register: clocksource
- changed_when: False
- # Fail if clocksource is NOT "kvm-clock"
- - assert:
- that:
- - clocksource.stdout == "kvm-clock"
- - debug: var=timesync_servers
- roles:
- - { role: timesync-disabled, when: clocksource.stdout == "kvm-clock" and timesync_servers is not defined }
- - { role: timesync-enabled, when: clocksource.stdout != "kvm-clock" or timesync_servers is defined }
- ### VMware-Guests:
- # Open-VM-Tools: https://blogs.vmware.com/vsphere/2015/09/open-vm-tools-ovt-the-future-of-vmware-tools-for-linux.html
- - hosts:
- - virtguest_VMware
- gather_facts: no
- pre_tasks:
- - name: Get timesync status
- command: vmware-toolbox-cmd timesync status
- changed_when: False
- register: vmwtbcmd_timesync
- ignore_errors: True
- - name: Install Open-VM-Tools
- package:
- name: open-vm-tools
- state: present
- when: vmwtbcmd_timesync|failed
- - name: Get timesync status AGAIN
- command: vmware-toolbox-cmd timesync status
- changed_when: False
- register: vmwtbcmd_timesync
- - assert:
- that:
- - vmwtbcmd_timesync.stdout in ["Enabled", "Disabled"]
- roles:
- - { role: timesync-disabled, when: vmwtbcmd_timesync.stdout == "Disabled" }
- - { role: timesync-enabled, when: vmwtbcmd_timesync.stdout == "Enabled"}
- ### Xen-Guests: https://wiki.xen.org/wiki/Xen_FAQ_DomU#How_can_i_synchronize_a_dom0_clock.3F
- - hosts:
- - virtguest_xen
- gather_facts: no
- pre_tasks:
- - command: cat /proc/sys/xen/independent_wallclock
- changed_when: False
- register: independent_wallclock
- - assert:
- that:
- - independent_wallclock.stdout == "1"
- roles:
- - timesync-enabled
- ### FIXME
- - hosts:
- - virtguest_RHEV
- - virtguest_virtualbox
- - virtguest_VirtualPC
- - virtguest_parallels
- - virtguest_powervm_lx86
- - "virtguest_PR/SM_LPAR"
- - virtguest_ibm_systemz
- gather_facts: no
- tasks:
- - fail:
- msg: "Not yet implemented"
|