Reputation: 1579
I've setup Amazon's dynamic inventory for Ansible according to https://aws.amazon.com/blogs/apn/getting-started-with-ansible-and-dynamic-amazon-ec2-inventory-management/. I'm able to get an inventory of every EC2 instance on this account but I'd like to filter that down using tags. I've set instance_filters
in my ec2.ini but the script still returns the entire inventory.
instance_filters = tag:environment=qa
ansible all -i ec2.py -m ping
I also made sure the environment variable to point to ec2.ini was set.
export EC2_INI_PATH=/path/to/ec2.ini/its/different/on/my/machine/I/swear
What steps/configs am I missing that actually filters EC2 instances?
Upvotes: 0
Views: 1047
Reputation: 1579
The instance_filters
config was working as expected. The problem was that the extra "hosts" I was picking up were actually ElasiCache clusters. In order to exclude those from inventory I had to add the config below to ec2.ini.
elasticache = False
Upvotes: 0