ansible / galaxy

Legacy Galaxy still available as read-only on https://old-galaxy.ansible.com - looking for the new galaxy -> https://github.com/ansible/galaxy_ng
Apache License 2.0
855 stars 331 forks source link

Ansible-galaxy requires access to "/etc/ansible" even when ansible installed in python virtual environment #3332

Open dwebr opened 9 months ago

dwebr commented 9 months ago

Bug Report

SUMMARY

Ansible is not installed on host, so /etc/ansible does not exist. Ansible is installed in python virtual environment using pip install ansible Using ansible-galaxy to install collections fails with [Errno 13] Permission denied: '/etc/ansible' On a previous bastion servers (Redhat7), ansible was installed on the host but never actually used, we always run within a virtual environment. On the new bastion server, ansible was not installed which we didn't think would be a problem since it is not used directly, but found some collections and ansible-galaxy appear to rely on /etc/ansible

STEPS TO REPRODUCE

1.) activate virtual environment 2.) attempt to use ansible-galaxy to install collection

[user@bastion ~]$ source /opt/netadmin/ve/ansible3.11.8/bin/activate
(ansible3.11.8) [user@bastion ~]$
(ansible3.11.8) [user@bastion ~]$ ansible-galaxy collection install f5networks.f5_modules --force
Starting galaxy collection install process
Process install dependency map
[WARNING]: Skipping Galaxy server https://galaxy.ansible.com. Got an unexpected error when getting available versions of collection f5networks.f5_modules: Unknown error when attempting to call Galaxy at
'https://galaxy.ansible.com/api/': [Errno 13] Permission denied: '/etc/ansible'. [Errno 13] Permission denied: '/etc/ansible'
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': [Errno 13] Permission denied: '/etc/ansible'. [Errno 13] Permission denied: '/etc/ansible'
EXPECTED RESULTS

I expect the collection to be installed in ~/.ansible/collections

ACTUAL RESULTS

I get the error

ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': [Errno 13] Permission denied: '/etc/ansible'. [Errno 13] Permission denied: '/etc/ansible'
dwebr commented 9 months ago

An update to this ... the /etc/ansible directory did exist, it was not readable by my user. Linux admin, added read permission and galaxy and the f5 modules appear to work. Still why the dependency on /etc/ansible, where is this defined, its not in my ansible.cfg anywhere.