From 371146c4edb2b82aebdfce8f673648517c741c91 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 30 Dec 2022 02:29:16 -0500 Subject: [PATCH] 0-init/tasks/tz.yml: Why ansible_date_time.tz is a problem --- roles/0-init/tasks/tz.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/roles/0-init/tasks/tz.yml b/roles/0-init/tasks/tz.yml index 017947a05..9874b77b9 100644 --- a/roles/0-init/tasks/tz.yml +++ b/roles/0-init/tasks/tz.yml @@ -1,3 +1,21 @@ +# 2022-12-30: FYI ansible_date_time.tz provides TZ ABBREVIATIONS (equivalent +# to 'date +%Z' output) which leads to serious ambiguity -- and not just (A) +# seasonal EST/EDT ambiguities, or (B) floods of geographic synonyms for the +# very same time zone! More Seriously: (C) both commands above output "IST" +# for both Israel Standard Time (+0200) AND India Standard Time (+0530). Etc! +# +# While Ansible provides 2 other vars that (slightly) help disambiguate +# (ansible_date_time.tz_dst and ansible_date_time.tz_offset), there's a far +# better way -- which is to read the System TZ directly from Linux: +# +# timedatectl show -p "Timezone" --value +# +# This takes care of essentially everything (e.g. output "America/New_York") +# by checking (1) symlink /etc/localtime then (2) text file /etc/timezone +# then (3) if neither exist, then "UTC" is declated (correctly!) One +# drawback: timedatectl if not easily usable within chroot environments. + + - name: "'local_tz: {{ local_tz }}' was set by ansible_date_time.tz in /opt/iiab/iiab/vars/default_vars.yml -- e.g. if Ansible finds symlink /etc/localtime -> ../usr/share/zoneinfo/America/New_York -- it will simplify that to 'EDT' (in the summer) or 'EST' (in the winter)" command: echo