Louis_Jen
(Louis Jen)
October 22, 2018, 8:06am
1
Hi all,
I thought if I put a
command: “printenv | grep PWD”
delegate_to: localhost
run_once: ture
into awx-task container playbook, I will get the env variable PWD value which is the current project path of the ansible AWX controller.
but the value is not equal to {{ lookup(‘env’, ‘PWD’) }}, which it is “/var/lib/awx/”.
so, my question is how can I check all the ‘env’ variables of AWX and where is the ‘env’ file on AWX?
Thanks in advance.
regards,
Louis
Hi Louis,
You are not getting what you expect because you are using the command module, which is not processed through a shell.
Regards,
Adrian
Louis_Jen
(Louis Jen)
October 22, 2018, 11:32am
4
sorry, it shows the variable “ansible_env” is not defined…
Louis_Jen
(Louis Jen)
October 22, 2018, 11:33am
5
So… what is the correct way?
sdmorel
October 22, 2018, 11:38am
6
Hello,
The ansible_env variable is populated in the gather_facts task.
You will see it in the playbook but you won’t see it running the ansible ad-hoc command.
Regards,
Sergio