# alter PATH for all tasks running on a specific host group?

**URL:** <https://forum.ansible.com/t/alter-path-for-all-tasks-running-on-a-specific-host-group/18246>\
**Category:** Ansible Project\
**Created:** [May 17, 2015, 2:55am UTC](https://forum.ansible.com/t/alter-path-for-all-tasks-running-on-a-specific-host-group/18246 "2015-05-17T02:55:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Peters](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Alex\_Peters](https://forum.ansible.com/u/Alex_Peters)\
**Post date:** [May 17, 2015, 2:55am UTC](https://forum.ansible.com/t/alter-path-for-all-tasks-running-on-a-specific-host-group/18246/1 "2015-05-17T02:55:03Z")

</div>

I have a couple playbooks that apply to a number of host groups, one group having /sbin (among other things) missing from its hosts’ PATHs.

This means that the playbooks run correctly on most hosts, but not the hosts in that particular group.

I realise that I can alter the playbooks’ affected tasks to manually set the PATH using the environment parameter. This solution is not ideal though because it’s addressing an issue relevant to the group, not the playbooks themselves.

I’d prefer to somehow have this information in a **group var** only. Is it possible to define a group var that causes the hosts in that group to have a modified PATH when running tasks? Do other solutions exist to this problem?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 18, 2015, 12:21pm UTC](https://forum.ansible.com/t/alter-path-for-all-tasks-running-on-a-specific-host-group/18246/2 "2015-05-18T12:21:38Z")

</div>

try

environment: "{{mysettings}}"

where mysettings is a group var

---

<div class="post-metadata">

**Author:** ![Alex\_Peters](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Alex\_Peters](https://forum.ansible.com/u/Alex_Peters)\
**Post date:** [July 5, 2015, 8:19am UTC](https://forum.ansible.com/t/alter-path-for-all-tasks-running-on-a-specific-host-group/18246/3 "2015-07-05T08:19:22Z")

</div>

I appreciate the suggestion, but this would still require modifying every task in every role that applies to this particular host group.

Is there any way to influence the environment of a host or host group without resorting to such per-task modifications?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 5, 2015, 12:05pm UTC](https://forum.ansible.com/t/alter-path-for-all-tasks-running-on-a-specific-host-group/18246/4 "2015-07-05T12:05:58Z")

</div>

It can be set at play level.
