Can I define my inventory in my playbook directory?
34 views
Skip to first unread message
skinnedknuckles
unread,
Aug 24, 2016, 11:02:37 AM8/24/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Management Node:
CentOs 6
Ansible 2.1
Remote Node:
Windows 7
Powershell 3.0
My playbooks are all saved in /home/username/playbooks.
My inventory file is saved as /etc/ansible/hosts.
And I also use the file etc/ansible/group_vars/windows.yml
I find it a hassle to go back and forth between these 2 locations. Why can't I define my inventory and group vars in my playbooks directory? What is the best way to do that?
Brian Coca
unread,
Aug 24, 2016, 11:08:18 AM8/24/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
inventory can be anywhere you want, it just defaults to /etc/ansible/hosts, you can set in ansible.cfg or on the command line with -i switch. group/host_vars just need to be in the same directory your inventory files are.
----------
Brian Coca
skinnedknuckles
unread,
Aug 31, 2016, 1:13:23 PM8/31/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
I must be missing something. I created a ansible.cfg file with this...
[default]
hostfile = /fs01/home/janderson/hosts
and one with this...
[default]
inventory = /fs01/home/janderson/hosts
and neither one worked.
Where can I get a default or sample ansible.cfg file to modify?
Dick Davies
unread,
Aug 31, 2016, 1:29:25 PM8/31/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible list
We lay ours out in the playbook directory like this
site.yml
prod/
- group_vars/
- all
- hosts
staging/
- group_vars/
- all
- hosts
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
On 31. aug. 2016 19:13, skinnedknuckles wrote:
> I must be missing something. I created a ansible.cfg file with this...
>
> [default]
> hostfile = /fs01/home/janderson/hosts
>
> and one with this...
>
> [default]
> inventory = /fs01/home/janderson/hosts
This last one is almost correct, but you are missing an s it's [defaults]
--
Kai Stian Olstad
skinnedknuckles
unread,
Aug 31, 2016, 2:42:02 PM8/31/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Thanks Kai for pointing out my mistake!!
On Wednesday, August 24, 2016 at 10:02:37 AM UTC-5, skinnedknuckles wrote: