Inventory path?

276 views
Skip to first unread message

sandev singh

unread,
Oct 13, 2017, 4:09:48 PM10/13/17
to Ansible Project
Hi, I am new to ansible and learning it. I installed it using pip on my Mac book, but when try to go to the default inventory location: /etc/ansible/hosts, it says - 

sandevs-MacBook-Air:~ sandevsingh$ cd /etc/ansible

-bash: cd: /etc/ansible: No such file or directory


I have checked that ansible is installed on my MacBook-

sandevs-MacBook-Air:~ sandevsingh$ ansible --version


ansible 2.4.0.0

  config file = None

  configured module search path = [u'/Users/sandevsingh/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']

  ansible python module location = /Library/Python/2.7/site-packages/ansible

  executable location = /usr/local/bin/ansible

  python version = 2.7.10 (default, Feb  7 2017, 00:08:15) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]


Please advise? 

Kai Stian Olstad

unread,
Oct 14, 2017, 10:27:18 AM10/14/17
to ansible...@googlegroups.com
On 13. okt. 2017 22:09, sandev singh wrote:
> Hi, I am new to ansible and learning it. I installed it using pip on my Mac
> book, but when try to go to the default inventory location:
> /etc/ansible/hosts, it says -
>
> *sandevs-MacBook-Air:~ sandevsingh$ cd /etc/ansible*
>
> *-bash: cd: /etc/ansible: No such file or directory*
>
> I have checked that ansible is installed on my MacBook-
>
> *sandevs-MacBook-Air:~ sandevsingh$ ansible --version*

This is normal with the pip install.

I don't recommend using /etc/asnible, I do recommend using some kind of
version control system(VCS) like git.
Create a directory in you home directory, eg. ansible.
In this directory create a file called ansible.cfg with following content
[default]
inventory = hosts


With this you inventory file will be called hosts, but you can change
that to whatever you want.

When you are in this directory ansible -version will show something like
this
# ansible --version
ansible 2.4.0.0
config file = /root/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules']
ansible python module location =
/usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0
20160609]

Then you can add this a VCS and track all the changes and share the code
with other.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages