I just tried this out and apparently the path you specify for ANSIBLE_CONFIG has to actually exist:
dick.visser@ams-049 ~ % export ANSIBLE_CONFIG=/opt/nonexistent/ansible.cfg dick.visser@ams-049 ~ % ansible --version ansible 2.10.12 config file = /Users/dick.visser/.ansible.cfg configured module search path = ['/Users/dick.visser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /Users/dick.visser/.pyenv/versions/3.9.6/lib/python3.9/site-packages/ansible executable location = /Users/dick.visser/.pyenv/versions/3.9.6/bin/ansible python version = 3.9.6 (default, Aug 11 2021, 12:13:01) [Clang 12.0.5 (clang-1205.0.22.11)] dick.visser@ams-049 ~ % export ANSIBLE_CONFIG=/opt/ansible.cfg dick.visser@ams-049 ~ % ansible --version ansible 2.10.12 config file = /opt/ansible.cfg configured module search path = ['/Users/dick.visser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /Users/dick.visser/.pyenv/versions/3.9.6/lib/python3.9/site-packages/ansible executable location = /Users/dick.visser/.pyenv/versions/3.9.6/bin/ansible python version = 3.9.6 (default, Aug 11 2021, 12:13:01) [Clang 12.0.5 (clang-1205.0.22.11)] On Wed, 22 Sept 2021 at 19:53, dulhaver via Ansible Project <[email protected]> wrote: > > hi everybody, > > Ansible novice here from Germany > > I learned that setting an environment variable for ANSIBLE_CONFIG (like > ANSIBLE_CONFIG=/path/to/any.cfg) would make the defined file the preferred > configuration file. > However I am still not able to get this working and I am using a fallback > configuration file (~/ansible.cfg) for ad-hoc commands as well as per > playbook execution. > > can anybody clarify what I did misunderstand in this logic? > > $ ansible --version > ansible [core 2.11.4] > config file = /home/username/AnsiblePlayground/ansible.cfg > configured module search path = ['/home/username/.ansible/plugins/modules', > '/usr/share/ansible/plugins/modules'] > ansible python module location = /usr/lib/python3.9/site-packages/ansible > ansible collection location = > /home/username/.ansible/collections:/usr/share/ansible/collections > executable location = /usr/bin/ansible > python version = 3.9.7 (default, Aug 31 2021, 13:28:12) [GCC 11.1.0] > jinja version = 3.0.1 > libyaml = True > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/2b1ac2a8-3121-1d78-0cfe-e77f73382231%40mailbox.org. -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwNh4dsY%2Bc2A1RZuBWJqNk4yUPUWwv9cYGk0Tcubm%2BnbrQ%40mail.gmail.com.
