ansibleubuntu-20.04ansible-awx

Ansible AWX container 17.0.1 date inside container not correct


I've install AWX container version which contain 4 containers (awx_task, awx_web, awx_postgres, awx_redis) on ubuntu 20.04

here is the ansible version inside container awx_web

enter image description here

I've add the env to change timezone to all containers in docker-compose.yml

 environment
    TZ: Aaia/Bangkok 

Once the containers are up so I've exec into them and checking with "date" command and the result is work as expect. The time is a Bangkok Timezone (+07)

So I've declare ansible global variable in one files (defaults.yml) and running basic playbook to print out the time from playbook if it is correct (these are execute inside container awx_web)

TIMESTAMP_BANGKOK: "{{ lookup('pipe', 'date +%Y-%m-%dT%H:%M:%SZ') }}"

enter image description here

You can see the result above are correct

but when I run this playbook on AWX GUI the output of the same playbook are incorrect (it shown UTC +0 instead).

but the execute time at the right side is Bangkok time.

enter image description here

What could be wrong and where should I reconfigure? any suggestion is appreciated.

I've tried with setting the timezone but seem not helping

- name: Set timezone to Asia/Bangkok
  timezone:
    name: Asia/Bangkok

Solution

  • I've fixed this by adding TZ environment directly on command

    Before

    TIMESTAMP_BANGKOK: "{{ lookup('pipe', 'date +%Y-%m-%dT%H:%M:%SZ') }}"
    

    After

    TIMESTAMP_BANGKOK: "{{ lookup('pipe', 'TZ=Asia/Bangkok date +%Y-%m-%dT%H:%M:%SZ') }}"
    

    So I assume that declare Timezone in docker-compose or declare on the playbook pre_task doesn't help.