|  | 
| 48 | 48 |     plat__aws_xaccount_account_id: "{{ plat__cdp_xaccount_account_id }}" | 
| 49 | 49 | 
 | 
| 50 | 50 | # Runlevel first, upstream second, and discover third | 
| 51 |  | -- name: Discover AWS VPC if not defined | 
|  | 51 | +- name: Discover AWS VPC if not defined or established by Infrastructure | 
| 52 | 52 |   when: plat__aws_vpc_id == "" and infra__aws_vpc_id is undefined | 
| 53 | 53 |   block: | 
| 54 | 54 |     - name: Query AWS VPC by name | 
|  | 
| 70 | 70 |         plat__aws_vpc_id: "{{ __aws_vpc_info.vpcs[0].id }}" | 
| 71 | 71 | 
 | 
| 72 | 72 | - name: Set fact for AWS VPC ID if established by Infrastructure | 
| 73 |  | -  when: infra__aws_vpc_id is defined | 
|  | 73 | +  when: plat__aws_vpc_id == "" and infra__aws_vpc_id is defined | 
| 74 | 74 |   ansible.builtin.set_fact: | 
| 75 | 75 |     plat__aws_vpc_id: "{{ infra__aws_vpc_id }}" | 
| 76 | 76 | 
 | 
| 77 |  | -# Runlevel first, upstream second, and discover third | 
| 78 |  | -- name: Handle AWS Public and Private VPC Subnets if not defined | 
| 79 |  | -  when: not plat__aws_public_subnet_ids or not plat__aws_private_subnet_ids | 
|  | 77 | +- name: Handle AWS Subnet IDs if not defined | 
|  | 78 | +  when: not plat__aws_public_subnet_ids or not plat__aws_private_subnet_ids # Defaults are empty lists | 
| 80 | 79 |   block: | 
| 81 | 80 |     - name: Query AWS Subnets | 
| 82 | 81 |       amazon.aws.ec2_vpc_subnet_info: | 
|  | 
| 143 | 142 |   ansible.builtin.set_fact: | 
| 144 | 143 |     plat__endpoint_access_scheme: "PUBLIC" | 
| 145 | 144 | 
 | 
|  | 145 | +# TODO Collapse the two SG queries together | 
| 146 | 146 | - name: Discover AWS Security Group for Knox | 
| 147 | 147 |   when: infra__aws_security_group_knox_id is undefined | 
| 148 | 148 |   block: | 
| 149 | 149 |     - name: Query AWS Security Group for Knox | 
| 150 | 150 |       amazon.aws.ec2_group_info: | 
| 151 | 151 |         region: "{{ plat__region }}" | 
| 152 | 152 |         filters: | 
|  | 153 | +          vpc-id: "{{ plat__aws_vpc_id }}" | 
| 153 | 154 |           group-name: "{{ plat__security_group_knox_name }}" | 
| 154 | 155 |       register: __aws_security_group_knox_info | 
| 155 | 156 | 
 | 
|  | 
| 170 | 171 |       amazon.aws.ec2_group_info: | 
| 171 | 172 |         region: "{{ plat__region }}" | 
| 172 | 173 |         filters: | 
|  | 174 | +          vpc-id: "{{ plat__aws_vpc_id }}" | 
| 173 | 175 |           group-name: "{{ plat__security_group_default_name }}" | 
| 174 | 176 |       register: __aws_security_group_default_info | 
| 175 | 177 | 
 | 
|  | 
0 commit comments