1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
- name: "[Alpine] Install package: tzdata"
apk:
name: tzdata
state: present
update_cache: yes
when: ansible_distribution == "Alpine"
- name: Check that timezone exists
stat:
path: "/usr/share/zoneinfo/{{ system.timezone }}"
register: timezoneCheck
- fail:
msg: "Invalid timezone: {{ system.timezone }}"
when: not timezoneCheck.stat.exists
- name: "[Archlinux] Set timezone to: {{ system.timezone }}"
community.general.timezone:
name: "{{ system.timezone }}"
when: ansible_distribution == "Archlinux"
- name: "[Alpine] Set timezone to: {{system.timezone}}"
file:
src: "/usr/share/zoneinfo/{{ system.timezone }}"
path: /etc/localtime
state: link
when: ansible_distribution == "Alpine"