# Setting a sane default for DIST\_MODULE\_PATH

**URL:** <https://forum.ansible.com/t/setting-a-sane-default-for-dist-module-path/15457>\
**Category:** Ansible Developer\
**Created:** [June 12, 2014, 10:11pm UTC](https://forum.ansible.com/t/setting-a-sane-default-for-dist-module-path/15457 "2014-06-12T22:11:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kurt\_Bendl](https://avatars.discourse-cdn.com/v4/letter/k/258eb7/32.png) [@Kurt\_Bendl](https://forum.ansible.com/u/Kurt_Bendl)\
**Post date:** [June 12, 2014, 10:11pm UTC](https://forum.ansible.com/t/setting-a-sane-default-for-dist-module-path/15457/1 "2014-06-12T22:11:55Z")

</div>

Hi folks,

When installing the latest ansible (1.6.3) as a normal  
“unprivileged” user in a virtualenv via pip, this error  
is generated:

error: could not create ‘/usr/share/ansible’: Permission denied

Comments on a ticket not that ansible is a  
“…systems application, not just a python library”::

[https://github.com/ansible/ansible/issues/7450](https://github.com/ansible/ansible/issues/7450)

I’d like to consider that there may be instances where  
installing ansible in a more isolated environment would  
be preferable to injecting ansible into the sys.prefix  
or `/usr/local/share`.

I’d like to propose using ‘~/.ansible’ as a fallback.

In my environment, my preference is to leave the  
system python alone, and use isolated virtualenv  
setups for application installs. Ansible runs as  
a non-privileged user, and I’d expect it to be able  
to install without sudo/root privs.

I’m sure there are holes in my logic, but I’d suggest  
a patch that sets `DIST_MODULE_PATH` up front,  
similar to the changes here:

[https://github.com/itd/ansible/blob/devel/lib/ansible/constants.py#L93](https://github.com/itd/ansible/blob/devel/lib/ansible/constants.py#L93)

Lines 93-104 are the changes.

It uses the current default of ‘/usr/share/ansible/’  
but if the dir doesn’t already exist, and  
the user can’t create that dir, it assumes  
`~/.ansible/` as the default.

Okay. Tell me that it’s a bad idea and why, and I’ll gladly  
eat crow.

Thanks,  
Kurt

---

<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:** [June 13, 2014, 10:46pm UTC](https://forum.ansible.com/t/setting-a-sane-default-for-dist-module-path/15457/2 "2014-06-13T22:46:37Z")

</div>

So Twitter was saying they had some patches that dealt with this using setuptools, I’m still open to them, and this would make user level installs in pip a thing.

I think I’d prefer that than the system trying another path if the thing wasn’t writeable, as that may happen if someone just forgets to sudo.

I don’t think I like ~/.ansible as that tends to imply a data file directory and if things were lurking there, people might have mixed versions of ansible and their library files.

Open to ideas.
