Skip to content

Commit 091462b

Browse files
authored
Merge pull request #779 from kshtsk/wip-testnode-time-sync
Don't even try hwclock time sync on testnode if node is kvm
2 parents 4c31fc2 + 5adfc0a commit 091462b

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

roles/common/tasks/apt_systems.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
tags:
77
- timezone
88

9+
- name: Set the timezone for apt systems
10+
command: timedatectl set-timezone {{ timezone }}
11+
when:
12+
- current_tz.stdout|default("") != timezone
13+
- ansible_distribution_major_version|int >= 20
14+
tags:
15+
- timezone
16+
917
- name: Set the timezone in /etc/timezone
1018
copy:
1119
content: "{{ timezone }}"
@@ -14,14 +22,18 @@
1422
group: root
1523
mode: 0644
1624
# Default is used below to avoid breaking check mode
17-
when: current_tz.stdout|default("") != timezone
25+
when:
26+
- current_tz.stdout|default("") != timezone
27+
- ansible_distribution_major_version|int < 20
1828
register: etc_timezone
1929
tags:
2030
- timezone
2131

2232
- name: Inform the OS of the new timezone
2333
command: dpkg-reconfigure --frontend noninteractive tzdata
24-
when: etc_timezone is changed
34+
when:
35+
- etc_timezone is changed
36+
- ansible_distribution_major_version|int < 20
2537
tags:
2638
- timezone
2739

roles/common/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@
2525
- import_tasks: zypper_systems.yml
2626
when: ansible_pkg_mgr == "zypper"
2727

28+
- name: Capture current_clocksource content
29+
shell: "cat /sys/devices/system/clocksource/clocksource0/current_clocksource"
30+
failed_when: false
31+
register: current_clocksource
32+
2833
- name: Set the hardware clock
2934
command: hwclock --systohc
35+
# unless system clock is using kvm-clock
36+
when: current_clocksource.stdout.find('kvm-clock') == -1
3037
tags:
3138
- timezone
3239

roles/testnode/tasks/pip.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
name: "{{ pip_version }}"
2424
state: present
2525
enablerepo: epel
26-
when: ansible_pkg_mgr == "yum" and ansible_distribution != 'Fedora'
26+
when: (ansible_pkg_mgr == "yum" and ansible_distribution != 'Fedora') or
27+
(ansible_pkg_mgr == "dnf" and ansible_distribution != 'Fedora')
2728

2829
- name: Install python-pip on apt based systems.
2930
apt:

0 commit comments

Comments
 (0)