Issue with lib/ansible.egg-info/ ownership when running from source as different users

We have the need to run ansible from cron as root (to ensure the ‘ansible’ user exists on all remote hosts and its key is present in authorized_keys) as well as the the ‘ansible’ user.

The problem is that when root sources ./hacking/env-setup, the directory lib/ansible.egg-info/ becomes owned by root and the ansible user can no longer run the ./hacking/env-setup without getting permission errors.

Is there a better way to have this work than maintaining two separate versions of the source code?

Thanks,

Matt

We have the need to run ansible from cron as root (to ensure the
'ansible' user exists on all remote hosts and its key is present in
authorized_keys) as well as the the 'ansible' user.

The problem is that when root sources ./hacking/env-setup, the
directory lib/ansible.egg-info/ becomes owned by root and the ansible
user can no longer run the ./hacking/env-setup without getting
permission errors.

I posted about this too: https://groups.google.com/forum/#!topic/ansible-project/0Il-9M0iyPE

I had said

  In our particular case, we don't think we care if pkg_resources knows
  about our off-in-a-corner-somewhere Ansible installation, and this would
  work fine for us if the 'rm -r' were an 'rm -rf' instead. (It'd fail,
  and we wouldn't ever know or care.)

We made this change in our local installation; if this behavior hasn't
changed in 2.0, I'll make a PR then.

                                      -Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

Thanks Josh. I can confirm we’re using the latest code from the devel branch (2.0) and this is still occurring.