===================================================
Here is my static inventory of dynamic groups
[tag_ENV_prod] [tag_ROLES_bastion] [prod-bastion:children] tag_ROLES_bastion:&tag_ENV_prod [prod-servers:children] tag_ENV_prod:!tag_ROLES_bastion
=================================================== Calling the groups via an adhoc ansible command does NOT work. $ ansible 'prod-bastion' -i ec2.py --list-hosts [WARNING]: provided hosts list is empty, only localhost is available hosts (0): $ ansible 'prod-servers' -i ec2.py --list-hosts [WARNING]: provided hosts list is empty, only localhost is available hosts (0): =================================================== This however works
$ ansible 'tag_ROLES_bastion:&tag_ENV_prod' -i ec2.py --list-hosts hosts (1): 192.168.1.4 $ ansible '\!tag_ROLES_bastion:tag_ENV_prod' -i ec2.py --list-hosts hosts (8): 192.168.1.12 192.168.1.30