Skip to main content

Ansible configuration file [Resolved]

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 ~]$

Question Credit: Prudhvi Bachineni
Question Reference
Asked May 24, 2019
Tags: ansible
Posted Under: Unix Linux
1 Answers

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.

credit: Vladimir Botka
Answered May 24, 2019
Your Answer