Can we put /etc/ansible/hosts file in other place?

53 views
Skip to first unread message

zixu mo

unread,
Jan 15, 2015, 8:32:13 PM1/15/15
to ansible...@googlegroups.com
Can we put /etc/ansible/hosts file in other place?

such as /home/tomy/ansible/hosts


I would not like to run ansible on my pc with root access.


Tom Bamford

unread,
Jan 16, 2015, 9:05:13 AM1/16/15
to ansible...@googlegroups.com

You can place your inventory file(s) anywhere you like. Reference them from ansible.cfg, or using -i /path/to/inventory


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/af24c63c-5817-4acb-8d82-11bfed942f4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Michel Blanc

unread,
Jan 16, 2015, 11:59:15 AM1/16/15
to ansible...@googlegroups.com
On 16/01/2015 02:32, zixu mo wrote:
> Can we put /etc/ansible/hosts file in other place?
>
> such as /home/tomy/ansible/hosts
>
> ?

As stated by Tom, you can use -i but you can also change your
~/.ansible.cfg :

[defaults]

# location of inventory file, eliminates need to specify -i
hostfile = /home/tomy/ansible/hosts

Note that you can put a .ansible.cfg file in your "projects" directory,
so you can ahave a "per-project" specific inventory.

M


--
Michel Blanc
{ :github => "@leucos", :twitter => "@b9m", :gpg => "0X24B35C22" }
Reply all
Reply to author
Forward
0 new messages