# Set environment variables for a whole playbook or a role

**URL:** <https://forum.ansible.com/t/set-environment-variables-for-a-whole-playbook-or-a-role/14618>\
**Category:** Ansible Project\
**Created:** [February 21, 2014, 12:02pm UTC](https://forum.ansible.com/t/set-environment-variables-for-a-whole-playbook-or-a-role/14618 "2014-02-21T12:02:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![judauphant](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@judauphant](https://forum.ansible.com/u/judauphant)\
**Post date:** [February 21, 2014, 12:02pm UTC](https://forum.ansible.com/t/set-environment-variables-for-a-whole-playbook-or-a-role/14618/1 "2014-02-21T12:02:45Z")

</div>

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 :

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [February 21, 2014, 1:22pm UTC](https://forum.ansible.com/t/set-environment-variables-for-a-whole-playbook-or-a-role/14618/2 "2014-02-21T13:22:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![judauphant](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@judauphant](https://forum.ansible.com/u/judauphant)\
**Post date:** [February 21, 2014, 1:36pm UTC](https://forum.ansible.com/t/set-environment-variables-for-a-whole-playbook-or-a-role/14618/3 "2014-02-21T13:36:26Z")

</div>

Ok thanks for your answer.

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

Best regards,
