Hi All,
I am attempting to create an AWS VPC and AWS DB subnet group within an Ansible play. My problem is that I need to know the subnet ids in order to create a DB subnet group. I have registered the results of the ec2_vpc module. This gives me access to the subnets and their ids but does not seem to be ordered. I have 6 subnets, 2 of which are DB subnets. They are marked with a tag. I need to get a list of 2 subnet ids to pass to the db_subnets module. Can anyone suggest a good way to do this? I tried doing a set_fact with a “with_items” and “when” but that gives only a single subnet. Of course I don’t know what the subnet ids are until after the VPC is created. I would really rather not have to manually add these in and run another play.
Thanks,
Michael