Categories

Nov 13, 2019 in Ansible
Q: What is the way to access shell environment variables in Ansible?

1 Answer

Nov 13, 2019
In Ansible, if you want to access existing variables, then you need to use the 'env' lookup plugin.

For example, you want to access the value of the Office environment on the management machine, as shown in the following command, such as:

---  

# ...  

vars:  

local_home: "{{ lookup('env','Office') }}"  

I  

{{ ansible_env.SOME_VARIABLE }}
Click here to read more about Ansible
Click here to read more about Insurance

Related questions

Madanswer
Nov 5, 2019 in Ansible
Nov 13, 2019 in Ansible
Mar 3 in React JS
...