mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
bac2012f05
3 changed files with 33 additions and 6 deletions
|
@ -74,8 +74,7 @@
|
|||
|
||||
# Put all computed vars here so derive properly from any prior var file
|
||||
- name: If the TZ is not set in env, set it to UTC
|
||||
set_fact: local_tz='UTC'
|
||||
when: local_tz == ""
|
||||
include_tasks: tz.yml
|
||||
|
||||
- name: Set port 80 for Admin Console
|
||||
set_fact:
|
||||
|
|
32
roles/0-init/tasks/tz.yml
Normal file
32
roles/0-init/tasks/tz.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
- name: Check if the TZ is not already set via /etc/localtime - Can Fail
|
||||
shell: readlink /etc/localtime | awk -F "zoneinfo/" '{print $2}'
|
||||
register: TZ_set
|
||||
ignore_errors: True
|
||||
|
||||
- name: Set local and iiab TZ to UTC if /etc/localtime is not set
|
||||
set_fact:
|
||||
local_tz: 'UTC'
|
||||
iiab_TZ: 'UTC'
|
||||
when: TZ_set.stdout == ""
|
||||
|
||||
- name: Override ansible on timezone if TZ set
|
||||
set_fact:
|
||||
local_tz: '{{ TZ_set.stdout }}'
|
||||
when: TZ_set.stdout != ""
|
||||
|
||||
- name: Using iiab TZ for local TZ
|
||||
set_fact:
|
||||
local_tz: '{{ iiab_TZ }}'
|
||||
when: iiab_TZ is defined and iiab_TZ != "" and iiab_TZ != "TZ_set.stdout"
|
||||
|
||||
- name: Set default Timezone from iiab TZ - Debian
|
||||
shell: timedatectl set-timezone {{ iiab_TZ }}
|
||||
when: is_debuntu and iiab_TZ is defined and iiab_TZ != "" and iiab_TZ != "TZ_set.stdout"
|
||||
|
||||
- name: Set default Timezone from iiab TZ - Redhat
|
||||
file:
|
||||
path: /etc/localtime
|
||||
src: /usr/share/zoneinfo/{{ iiab_TZ }}
|
||||
force: yes
|
||||
state: link
|
||||
when: is_redhat and iiab_TZ is defined and iiab_TZ != "" and iiab_TZ != "TZ_set.stdout"
|
|
@ -32,10 +32,6 @@
|
|||
- sysctl: name=net.ipv6.conf.default.disable_ipv6 value=1 state=present
|
||||
- sysctl: name=net.ipv6.conf.lo.disable_ipv6 value=1 state=present
|
||||
|
||||
- name: Set default Time Zone
|
||||
shell: ln -sf /usr/share/zoneinfo/{{ iiab_TZ }} /etc/localtime
|
||||
when: iiab_TZ is defined and iiab_TZ != ""
|
||||
|
||||
- name: Install custom profile file
|
||||
template: dest=/etc/profile.d/zzz_iiab.sh
|
||||
src=zzz_iiab.sh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue