Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
variable for server as entered in inventory
12 views
Skip to first unread message
Ed Greenberg
unread,
Dec 21, 2015, 9:13:11 PM
12/21/15
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 have an inventory that contains (for example):
[servers]
1.2.3.4
1.2.3.5
1.2.3.6
server1.foo.bar
server2.foo.bar
I'd like to access the entry under servers as a {{ variable }} in a playbook, for each of the entries that are processed.
I've read the pages on ansible variables, but didn't find anything that was a simple as what I'm looking for.
Can somebody point me appropriately?
Thanks,
Ed Greenberg
Brian Coca
unread,
Dec 21, 2015, 9:25:17 PM
12/21/15
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
inventory_hostname has the name of the current host, so :
- hosts: servers
tasks:
- debug: var=inventory_hostname
should do what you want.
--
Brian Coca
Reply all
Reply to author
Forward
0 new messages