Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible: path to ansible.cfg

Tags:

ansible

I have this known issue. So I try to fix it but I don't see where I have to create my ansible.cfg (or does it already exist)? I tried it in my homedirectory but it still did not work.

sudo vi ~/.ansible.cfg

I read a lot about /etc/ansible but on my system it isn't there. I'm on Mac El Capitan. I've installed ansible by using pip.

ansible --version
ansible 1.9.4
  configured module search path = None
like image 597
lova Avatar asked Mar 13 '16 11:03

lova


1 Answers

For latest version (2.7.6) if you install via pip you wont get ansible folder in /etc. so this is what you get when you do ansible --version

ansible --version
ansible 2.7.6
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible

But once you manually create directory under /etc as ansible and add ansible.cfg file there ansible automatically detects it. but you will have to configure the rest manually like hosts file..etc . so after this we get

ansible --version
ansible 2.7.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
like image 147
MD5 Avatar answered Oct 09 '22 10:10

MD5