I executed following playbook that uses lookup module and the "environment" settings.But can not access environment variables.
How can I access environment variables?
---
- hosts: all
user: root
vars:
env:
http_proxy: http://proxy.example.com:8080
tasks:
- shell: "echo {{ lookup('env', 'http_proxy') }}"
environment: env
Output with trace logs.
TASK: [common | shell echo ] **************************************************
<localhost> REMOTE_MODULE command echo #USE_SHELL
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1431940001.28-180226385575167 && echo $HOME/.ansible/tmp/ansible-tmp-1431940001.28-180226385575167']
<localhost> PUT /tmp/tmpbTOkKM TO /root/.ansible/tmp/ansible-tmp-1431940001.28-180226385575167/command
<localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 http_proxy=http://proxy.example.com:8080 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1431940001.28-180226385575167/command; rm -rf /root/.ansible/tmp/ansible-tmp-1431940001.28-180226385575167/ >/dev/null 2>&1']
changed: [localhost] => {"changed": true, "cmd": "echo", "delta": "0:00:00.002729", "end": "2015-05-18 09:06:41.343183", "rc": 0, "start": "2015-05-18 09:06:41.340454", "stderr": "", "stdout": "", "warnings": []}