# Environment Variable Interpolation within PATHs in ansible.cfg

**URL:** <https://forum.ansible.com/t/environment-variable-interpolation-within-paths-in-ansible-cfg/17164>\
**Category:** Ansible Developer\
**Created:** [December 31, 2014, 7:01am UTC](https://forum.ansible.com/t/environment-variable-interpolation-within-paths-in-ansible-cfg/17164 "2014-12-31T07:01:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mick\_Bass](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@Mick\_Bass](https://forum.ansible.com/u/Mick_Bass)\
**Post date:** [December 31, 2014, 7:01am UTC](https://forum.ansible.com/t/environment-variable-interpolation-within-paths-in-ansible-cfg/17164/1 "2014-12-31T07:01:58Z")

</div>

Hi All. Great work with Ansible!!

I’m trying to use ansible.cfg to specify paths to plugins in a controlled manner. The path varies based on the installation, so I’d like to say something like:

> filter\_plugins = $PLUGIN\_PATH/filter\_plugins

> action\_plugins = $PLUGIN\_PATH/action\_plugins

And then specify PLUGIN\_PATH in the environment when launching ansible-playbook.

It’s not working, apparently because some paths in ansible.cfg have shell variable expansion applied, and others do not. I could specify each of ANSIBLE\_FILTER\_PLUGINS, ANSIBLE\_ACTION\_PLUGINS etc. independently, but that’s cumbersome.

Is there any reason that environment variables are not consistently expanded for all of these \*\_PATH entries? Are you open to a PR that consistently applies shell\_expand\_path() to all of the paths below?

From constants.py:

---

<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:** [January 7, 2015, 4:19pm UTC](https://forum.ansible.com/t/environment-variable-interpolation-within-paths-in-ansible-cfg/17164/2 "2015-01-07T16:19:35Z")

</div>

That’s a _really_ good point and this should definitely be consistent.

Let’s add an expand=True to the get\_config method and we can take it.

However note that the ‘v2’ refactoring is still underweigh for core… so you _may_ wish to just file this as a bug report rather than a PR, that way we can make sure it’s applied to v2, since if it’s applied to the old tree, it won’t automatically hop over to the new one.

---

<div class="post-metadata">

**Author:** ![Mick\_Bass](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@Mick\_Bass](https://forum.ansible.com/u/Mick_Bass)\
**Post date:** [January 9, 2015, 3:10pm UTC](https://forum.ansible.com/t/environment-variable-interpolation-within-paths-in-ansible-cfg/17164/3 "2015-01-09T15:10:57Z")

</div>

Thanks Michael.

I filed a [bug report](https://github.com/ansible/ansible/issues/9967) on github.
