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 ?
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.
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’
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.
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.