Skip to content

Default to storing inventory alongside project (instead of /etc/ansible/hosts) #260

@geerlingguy

Description

@geerlingguy

A reader recently sent in this feedback:

I always found it odd that, by default, I had to add the Inventory to /etc/ansible/hosts. When I am running on a hosted environment I usually do not have access to the root-tree and furthermore, when focusing on infrastructure-as-code my inventories belong inside a scm anyways.

You mention how to pass a inventory via cli in the book, but at a rather late stage. I remember that when I started with Ansible (before your book) it was the first thing I tried to figure out.
So I would suggest to add this information in the beginning of the book, maybe as a note just where you explain the initial hosts-file.

As I've been working on the Ansible 101 video series, I noticed the same thing and was a little bothered by it. Nowadays, I always store my inventory (and, quite often, an ansible.cfg file with the path to it configured) inside my project directory.

I think I should default to that in all the early examples, and just mention that you can also store inventory globally in /etc/ansible/hosts.

Thanks Marc!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions