0

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 --verion", its getting the configuration from /etc/ansible/. How to do I point the my configuraion should be picked up from /apps/ansible ?

[ansible@Server ~]$ ansible --version
ansible 2.4.2.0
  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 ~]$
4

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.

  • 2
    Option 3: cd to /apps/ansible – mhutter Jan 4 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.