Hi, I’m working my way through a migration to EC2 dynamic inventory.
I have everything working, but I’m a bit stuck on how to filter the found instances.
If I have this in aws_ec2.py
, things work (i.e. I get the right instances):
plugin: amazon.aws.aws_ec2
regions:
- "{{ lookup('ansible.builtin.env', 'AWS_DEFAULT_REGION') }}"
filters:
tag:Environment: dev
I test this by:
ansible-inventory -i aws_ec2.py --list
But I’d like to use a variable for the environment. I thought that would be easy:
filters:
tag:Environment: "{{ env }}"
and then doing:
ansible-inventory -e env=dev -i aws_ec2.py --list
But now I don’t get any instances…
Any ideas if this is possible at all…?