I'll try to be more clear on the issue. We have 8 tags/groups per environment (staging/production) in different vpcs that need services provisioned and updated in EC2:
webservers
databases
dashboards
etc...
Since you can not use a variable from /etc/ansible in the 'hosts:' setting in a playbook, we can either
- use different group names for each environment (and hence need different plays per)
- ideally, use the same tag_Name setting across environments and rely on the
ec2.py/ini combo to filter for the right instances based on vpc subnet id
The second case is preferable, but despite filtering by vpc_id in ec2.py, the 'exact_count' setting in the ec2 module for provisioning looks at the number of instances tagged across vpcs.
Does anyone know of a way to make it only consider the instances that pass the instance filters from the dynamic inventory script?