inventory group name variable

I am kindda new to Ansible and I’ve been trying to find this information everywhere, but I can’t seen to get what I really need, which is:

given a inventory with a group name [xyz] for example, while running ansible with that inventory and pointing to that group specifically like:

ansible -i my_inventory xyz -m debug -a “msg=‘the group I am using is {{ ???_does this_variable_exist_predefined_anywhere??? }}’”

help?

It's not possible to get that information.

Thanks so much Kai, I’ve been eagerly searching these next few moments and found out it’s really nowhere, but good came out of that and I realized I can do a “dynamic inventory” and pass it on as “.py” to -i option of ansible!!! (http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html)

I will try that from the docs and see how it goes: "

ansible -i openstack.py all -m ping"

this could save my day and add some fun to my inventories.

Thank you for your prompt answer.

Ansible has hosts and tasks as the primary objects, groups are only
used in inventory to allow for host selection and convenient variable
assignment. Once we start task execution, they are just 'labels'
associated with a host, the variable `group_names` contains all the
groups of the current host.

Also, hosts are always at least part of 2 groups, one of them being
'all' (implicit localhost being the exception).