The hwclock is not accessible for kvm nodes and trying to set it
creates an error:
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --verbose option to see the details of our search for an access method.
In that case try and check if current clock is using 'kvm-clock'
and just skip this step.
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@clyso.com>
- import_tasks: zypper_systems.yml
when: ansible_pkg_mgr == "zypper"
+- name: Capture current_clocksource content
+ shell: "cat /sys/devices/system/clocksource/clocksource0/current_clocksource"
+ failed_when: false
+ register: current_clocksource
+
- name: Set the hardware clock
command: hwclock --systohc
+ # unless system clock is using kvm-clock
+ when: current_clocksource.stdout.find('kvm-clock') == -1
tags:
- timezone