Hi All,
I’m trying to create a dynamic group of hosts that are in the intersection of 3 other groups. From what I am reading, I see that the new aws_ec2 and constructed inventory plugins should be able to do what I want. However I try per the documentation and it doesn’t appear to be working.
I have the following:
aws_ec2.yml
plugin: aws_ec2
regions:
- us-west-2
boto_profile: correct_profile
hostnames:
- private-ip-address
1-groups.config
plugin: constructed
keyed_groups:
- prefix: tag
key: tags - prefix: instance_type
key: instance_type - key: ‘security_groups|json_query(“.group_name”)’
prefix: “security_group” - key: placement.region
prefix: aws_region - key: platform
prefix: platform
groups:
managed_web_servers: (group_names|intersect([‘platform_windows’,‘tag_creator_deployagent_service’]))
complex group membership
multi_group: (group_names)
I run it with
`
ansible-inventory -i inventory/path/aws_ec2.yml -i inventory/1-groups.config
`
In my output, I do see the platform_windows and tag_creator_deployagent_service groups. I do see multi_group as well. However managed_web_servers are nowhere to be found. I thought I pulled this from the documentation correctly, but it’s not doing what I suspect it should. Could anyone share advice on this and/or help me debug it? There don’t seem to be a lot of examples of the new inventory plugins, or my google-fu is failing me.
Thanks,
-Derek