I have my ansible.cfg file in /etc/ansible/ as well as /apps/ansible/. We have made all the required setup in /apps/ansible/. Now, I have created new user and have all the ssh keys setup for the client nodes. But, when I switch to the user and execute ansible --version, its getting the configuration from /etc/ansible/. How do I ensure that the configuration is picked up from /apps/ansible?

[ansible@Server ~]$ ansible --version
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, May 31 2018, 09:41:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
[ansible@Server ~]$

For a user to use /apps/ansible/ansible.cfg you can either

  1. Link ~/.ansible.cfg (in the home directory) to /apps/ansible/ansible.cfg, or
  2. Set ANSIBLE_CONFIG (environment variable) to /apps/ansible/ansible.cfg

Refer to details.

| improve this answer | |
  • 2
    Option 3: cd to /apps/ansible – mhutter Jan 4 '19 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.