1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/0-init/tasks/tz.yml

33 lines
1 KiB
YAML
Raw Normal View History

2017-11-19 04:09:31 +00:00
- name: Check if the TZ is not already set via /etc/localtime - Can Fail
2017-10-08 21:51:54 +00:00
shell: readlink /etc/localtime | awk -F "zoneinfo/" '{print $2}'
register: TZ_set
ignore_errors: True
2017-11-19 04:09:31 +00:00
- name: Set local and iiab TZ to UTC if /etc/localtime is not set
set_fact:
local_tz: "UTC"
iiab_TZ: "UTC"
2017-10-08 21:51:54 +00:00
when: TZ_set.stdout == ""
2017-11-19 04:09:31 +00:00
- name: Override ansible on timezone if TZ set
set_fact:
local_tz: "{{ TZ_set.stdout }}"
2017-11-19 04:09:31 +00:00
when: TZ_set.stdout != ""
- name: Using iiab TZ for local TZ
set_fact:
local_tz: "{{ iiab_TZ }}"
2017-11-19 04:09:31 +00:00
when: iiab_TZ is defined and iiab_TZ != "" and iiab_TZ != "TZ_set.stdout"
2017-12-29 07:24:04 +00:00
- name: Set default Timezone from iiab TZ (debuntu)
2017-10-08 21:51:54 +00:00
shell: timedatectl set-timezone {{ iiab_TZ }}
when: is_debuntu and iiab_TZ is defined and iiab_TZ != "" and iiab_TZ != "TZ_set.stdout"
2017-12-29 07:24:04 +00:00
- name: Set default Timezone from iiab TZ (redhat)
2017-11-19 04:09:31 +00:00
file:
2017-12-29 07:24:04 +00:00
path: /etc/localtime
src: "/usr/share/zoneinfo/{{ iiab_TZ }}"
force: yes
state: link
2017-10-08 21:51:54 +00:00
when: is_redhat and iiab_TZ is defined and iiab_TZ != "" and iiab_TZ != "TZ_set.stdout"