Set environment variables for a whole playbook or a role

4,064 views
Skip to first unread message

judau...@gmail.com

unread,
Feb 21, 2014, 7:02:45 AM2/21/14
to ansible...@googlegroups.com
Hi every body,

I know that It's possible to set environnement variables for one task.

Is that possible to setup environment variables for a whole playbook or eventually a role ? (without add environnement keyword in every tasks)

Something like that :
---
 - hosts: webservers
   roles:
     - php
     - nginx
   environment:
     http_proxy: http://my.proxy:8080
   
I have try lot of things and check the source but I find nothing :(

Thanks in advance for your answers,
Best regards,
Julien


Michael DeHaan

unread,
Feb 21, 2014, 8:22:25 AM2/21/14
to ansible...@googlegroups.com
The environment keyword currently applies to a specific task, for instance so you can apply the proxy to some tasks that need a proxy, and turn it off for some tasks that cannot use the proxy -- which is a real world scenario for many people.

I'm open to pull requests that enable it at play level of course, and that would be a welcome addition.  If not, you could also file a feature request on github.




--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Julien DAUPHANT

unread,
Feb 21, 2014, 8:36:26 AM2/21/14
to ansible-project
Ok thanks for your answer.

If I find the time, I will code it and made a pull request.

Best regards,
Julien
----
Focus problems when you work on your computer ? try http://www.boxti.me
Empty and full Velib' station bother you ? try http://www.veliberation.fr
You love Scala, FreeBSD, Ansible ? Me too, let's discuss that next time I see you !


--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/w3aqRqZ1hIw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages