File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 6
6
tags :
7
7
- timezone
8
8
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
+
9
17
- name : Set the timezone in /etc/timezone
10
18
copy :
11
19
content : " {{ timezone }}"
14
22
group : root
15
23
mode : 0644
16
24
# 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
18
28
register : etc_timezone
19
29
tags :
20
30
- timezone
21
31
22
32
- name : Inform the OS of the new timezone
23
33
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
25
37
tags :
26
38
- timezone
27
39
Original file line number Diff line number Diff line change 25
25
- import_tasks : zypper_systems.yml
26
26
when : ansible_pkg_mgr == "zypper"
27
27
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
+
28
33
- name : Set the hardware clock
29
34
command : hwclock --systohc
35
+ # unless system clock is using kvm-clock
36
+ when : current_clocksource.stdout.find('kvm-clock') == -1
30
37
tags :
31
38
- timezone
32
39
Original file line number Diff line number Diff line change 23
23
name : " {{ pip_version }}"
24
24
state : present
25
25
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')
27
28
28
29
- name : Install python-pip on apt based systems.
29
30
apt :
You can’t perform that action at this time.
0 commit comments