Search code examples
ansible

ansible config file not found; using defaults


I have created venv called ansible and installed ansible using pip3 install ansible. Now while checking ansible version config file = None

ansible --version
ansible 2.9.12
  config file = None
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/ansible/lib/python3.7/site-packages/ansible
  executable location = /home/ansible/ansible/bin/ansible
  python version = 3.7.4 (default, Aug 18 2019, 12:04:45) [GCC 5.4.0 20160609]

When I run ansible command it says No config file found; using defaults but which is that defaults file and where it can be found ?


Solution

  • Q: "Which is that default file and where can it be found?"

    A: Short answer: There doesn't have to be any configuration file. In this case, the hardcoded defaults will apply.

    Details:

    "If installing Ansible from a package manager, the latest ansible.cfg file should be present in /etc/ansible ..."

    1. ansible.cfg (in the current directory)
    2. ~/.ansible.cfg (in the home directory)
    3. /etc/ansible/ansible.cfg
    • If there isn't any configuration file the defaults will apply. See the hardcoded defaults in Ansible Configuration Settings. The output of the below command will show you where each configuration option comes from
    shell> ansible-config dump