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": []}


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c00f5ff2-5f5b-4892-8a2a-57484b242373%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to