I'm in the process of creating a collection and I have a virtual env set up in the current directory, with Ansible 2.9 installed. When I run Ansible however, it is going straight to the .ansible.cfg file in my user's home directory and ignores the ansible.cfg file I created in the collection dir. The folder layout is as follows:
ansible.cfg docs env galaxy.yml hosts.yml playbooks plugins README.md requirements.txt roles
My venv is enabled and when I run ansible it shows the following:
(env) root@DESKTOP-JH6A27J:~/work/knightsg/dkron# ansible --version
ansible 2.9.9
config file = /root/.ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /mnt/c/Users/guy/Documents/Work/knightsg/dkron/env/lib/python3.6/site-packages/ansible
executable location = /mnt/c/Users/guy/Documents/Work/knightsg/dkron/env/bin/ansible
python version = 3.6.5 (default, May 3 2018, 10:08:28) [GCC 5.4.0 20160609]
As you can see, it's using /root/.ansible.cfg.
If I supply ANSIBLE_CONFIG then it uses the ansible.cfg file in the current folder:
(env) root@DESKTOP-JH6A27J:~/work/knightsg/dkron# ANSIBLE_CONFIG=./ansible.cfg ansible --version
ansible 2.9.9
config file = /mnt/c/Users/guy/Documents/Work/knightsg/dkron/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /mnt/c/Users/guy/Documents/Work/knightsg/dkron/env/lib/python3.6/site-packages/ansible
executable location = /mnt/c/Users/guy/Documents/Work/knightsg/dkron/env/bin/ansible
python version = 3.6.5 (default, May 3 2018, 10:08:28) [GCC 5.4.0 20160609]
Any idea why Ansible isn't selecting the correct config file by default?
Thanks,
Guy