Hey chaps,
Is there any reason why “ec2_group_facts” is not using my fact? Can ec2_group_facts use defined facts?
-
name: Get vpc details
ec2_vpc_net_facts:
region: “{{new_region}}”
filters:
“tag:Name”: “blah*”
register: result -
name: Define VPC ID
set_fact:
new_vpcID: result.vpcs[0][‘id’] -
debug: var=“{{new_vpcID}}”
-
name: Get SG in new VPC
ec2_group_facts:
filters:
vpc-id: “{{new_vpcID}}”
So I can get the existing VPC…
TASK [debug] *******************************************************************
task path: /blah/blah/projects/query_network.yml:13
Monday 06 November 2017 12:07:34 +0000 (0:00:00.033) 0:00:00.753 *******
ok: [localhost] => {
“result.vpcs[0][‘id’]”: “vpc-c8f8f2a0”
}
But why is the filter “Get SG in new VPC” not getting any results?
TASK [Get SG in new VPC] *******************************************************
task path: /blah/blah/projects/query_network.yml:15
Monday 06 November 2017 12:07:34 +0000 (0:00:00.036) 0:00:00.789 *******
ok: [localhost] => {“changed”: false, “failed”: false, “security_groups”: }
META: ran handlers
META: ran handlers