/etc/ansible and ansible.cfg directory and files are missing in macosx (#31907)

2,322 views
Skip to first unread message

Deniz Rende

unread,
Oct 19, 2017, 2:35:10 AM10/19/17
to Ansible Project
Hello ,

I was wondering why in mac osx the directory /etc/ansible and ansible.cfg file are not automatically created when it is done through pip install. 

In other OS's such as ubuntu and centos, these directories are created through their package management installation automatically.

I would expect installation behaviour to be same accross all platforms.I do realize that the config file and the ansible directory can be created manually but I think having this in one platform and not having in the other may be causing inconsistencies. The ticket was closed as such as it was mentioned that this was an expected behaviour. Could someone be kind enough to explain why this inconsistency is expected ?

Thank you!

Regards,

Deniz Rende

Brian Coca

unread,
Oct 19, 2017, 9:53:12 AM10/19/17
to Ansible Project
This is not an OS X nor an Ansible issue, its a pip issue, it is not
designed to handle system configuration files. System packages ARE
designed to do this.



--
----------
Brian Coca

Julian Brown

unread,
Oct 19, 2017, 10:35:34 AM10/19/17
to Ansible Project
I used brew to install Ansible on my macbook pro, it did not create /etc/ansible either.

I also have my hosts and ansible.cfg from the directory and it works for me.

Julian

Brian Coca

unread,
Oct 19, 2017, 10:44:28 AM10/19/17
to Ansible Project
That is a brew specific problem, they DO create ansible.cfg but they
choose to use different directories.


----------
Brian Coca

Deniz Rende

unread,
Oct 19, 2017, 1:19:51 PM10/19/17
to Ansible Project
Brian,

So Per the documentation:


I decided to go ahead and build from source, because it says there in the documentation:

"Once running the env-setup script you’ll be running from checkout and the default inventory file will be /etc/ansible/hosts. You can optionally specify an inventory file (see Inventory) other than /etc/ansible/hosts:"
so following that:

deniz@lemtmp]$ git clone https://github.com/ansible/ansible.git --recursive
Cloning into 'ansible'...
remote: Counting objects: 265907, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 265907 (delta 13), reused 2 (delta 2), pack-reused 265888
Receiving objects: 100% (265907/265907), 87.31 MiB | 769.00 KiB/s, done.
Resolving deltas: 100% (170839/170839), done.
[deniz@lemtmp]$ cd ansible/
[deniz@lemansible]$ ls
CHANGELOG.md Makefile bin lib test
CODING_GUIDELINES.md README.md contrib licenses ticket_stubs
CONTRIBUTING.md RELEASES.txt docs packaging tox.ini
COPYING ROADMAP.rst docsite_requirements.txt requirements.txt
MANIFEST.in VERSION examples setup.py
MODULE_GUIDELINES.md ansible-core-sitemap.xml hacking shippable.yml
[deniz@lemansible]$  source ./hacking/env-setup
running egg_info
creating lib/ansible.egg-info
writing lib/ansible.egg-info/PKG-INFO
writing dependency_links to lib/ansible.egg-info/dependency_links.txt
writing requirements to lib/ansible.egg-info/requires.txt
writing top-level names to lib/ansible.egg-info/top_level.txt
writing manifest file 'lib/ansible.egg-info/SOURCES.txt'
reading manifest file 'lib/ansible.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'ticket_stubs'
no previously-included directories found matching 'hacking'
warning: no files found matching 'SYMLINK_CACHE.json'
writing manifest file 'lib/ansible.egg-info/SOURCES.txt'

Setting up Ansible to run out of checkout...

PATH=/private/tmp/ansible/bin:/private/tmp/ansible/test/runner:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/Cellar/python3/3.6.1/bin/python3:/Users/deniz/Code/Go/bin:/usr/local/Cellar/go/1.8.3/libexec/bin
PYTHONPATH=/private/tmp/ansible/lib:
MANPATH=/private/tmp/ansible/docs/man:

Remember, you may wish to specify your host file with -i

Done!

[deniz@lemansible]$ ls /etc/ansible
ls: /etc/ansible: No such file or directory

So it is not there despite what the offical doc is saying....Any ideas ?

Kai Stian Olstad

unread,
Oct 19, 2017, 1:40:21 PM10/19/17
to ansible...@googlegroups.com
On 19. okt. 2017 19:19, Deniz Rende wrote:
> So Per the documentation:
>
> http://docs.ansible.com/ansible/latest/intro_installation.html#running-from-source
>
> I decided to go ahead and build from source, because it says there in the
> documentation:
>
> "Once running the env-setup script you’ll be running from checkout and the
> default inventory file will be /etc/ansible/hosts. You can optionally
> specify an inventory file (see Inventory
> <http://docs.ansible.com/ansible/latest/intro_inventory.html>) other than
> /etc/ansible/hosts:"

<snip />


> Remember, you may wish to specify your host file with -i
>
> Done!
>
> [deniz@lemansible]$ ls /etc/ansible
> ls: /etc/ansible: No such file or directory
>
> So it is not there despite what the offical doc is saying....Any ideas ?
The docs says what is the default inventory file in Ansible, that doesn't mean that it will be automatically created, that is the job for the user/sysadmin.


--
Kai Stian Olstad

Deniz Rende

unread,
Oct 19, 2017, 1:44:51 PM10/19/17
to Ansible Project
Kai,

I am not just talking about inventory file....it is the /etc/ansible directory itself.

It is clear: "Once running the env-setup script you’ll be running from checkout and the 

> default inventory file will be /etc/ansible/hosts."

Ok, so forget about the inventory file, where is the /etc/ansible directory ?

Again, this did not happen with other distros such as Centos, or Ubuntu.

Kai Stian Olstad

unread,
Oct 19, 2017, 2:14:05 PM10/19/17
to ansible...@googlegroups.com
On 19. okt. 2017 19:44, Deniz Rende wrote:
> Kai,
>
> I am not just talking about inventory file....it is the /etc/ansible
> directory itself.
>
> It is clear: "Once running the env-setup script you’ll be running from
> checkout and the
>> default inventory file will be /etc/ansible/hosts."
>
> Ok, so forget about the inventory file, where is the /etc/ansible directory
> ?
>
> Again, this did not happen with other distros such as Centos, or Ubuntu.
The same is true for /etc/ansible, this is the default folder for Ansible but is not automatically created.

If using the source as you did or pip install on Centos or Ubuntu the /etc/ansible will not be created.

But using the yum package for Centos or deb package for Ubuntu the /etc/ansible will be created.
That's because the person who created the packages have added to the package the creation of the folder /etc/ansible and the files in it.
And as Brian mention the person that package the brew have chosen a different directory than /etc/ansible.

So if you using any other method of installing Ansible you must likely need to create the folder for yourself.

I have also written a little about it in this thread
https://groups.google.com/d/msg/ansible-project/KfyPYZLr2UU/aPtj-EUFAwAJ

--
Kai Stian Olstad

Deniz Rende

unread,
Oct 19, 2017, 3:29:19 PM10/19/17
to Ansible Project
Ok Kai, thank you so much! 
Reply all
Reply to author
Forward
0 new messages