How to get host/group name for dynamic inventory?

123 views
Skip to first unread message

Souren Abeghyan

unread,
Apr 5, 2016, 4:36:03 PM4/5/16
to Ansible Project

Having ec2 dynamic inventory and pattern in hosts:

- hosts: [tag_Name_m*]

which variable holds the full host/tag/group name?

Zacharias Thompson

unread,
Apr 7, 2016, 12:02:57 AM4/7/16
to Ansible Project
You can always see all the variables available to you by doing something like what was posted here: https://gryzli.info/2015/05/29/ansible-dump-all-variables/

The other option would be to just create a task that prints out current variables, example:

 - name: See Variables
   hosts
: [tag_name_m*]
   connection
: local
   tasks
:
   
- name: see vars



      debug: var=vars

Brian Coca

unread,
Apr 7, 2016, 10:36:16 AM4/7/16
to ansible...@googlegroups.com
play_hosts has the 'list of current hosts in play'



--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages