|
58 | 58 | "tag:Name": "{{ plat__vpc_name }}" |
59 | 59 | register: __aws_vpc_info |
60 | 60 |
|
61 | | - - name: jenright Debug Print Discover AWS VPC |
62 | | - ansible.builtin.debug: |
63 | | - var: __aws_vpc_info |
64 | | - |
65 | 61 | - name: Set fact for AWS VPC ID |
66 | 62 | when: __aws_vpc_info is defined |
67 | 63 | ansible.builtin.set_fact: |
|
72 | 68 | ansible.builtin.set_fact: |
73 | 69 | plat__aws_vpc_id: "{{ infra__aws_vpc_id }}" |
74 | 70 |
|
75 | | - |
76 | | -- name: jenright Debug Print Set AWS VPC ID by assignment |
77 | | - ansible.builtin.debug: |
78 | | - msg: |
79 | | - - "infra__aws_vpc_id = {{ infra__aws_vpc_id | default('THIS_IS_UNDEFINED')}}" |
80 | | - - "plat__aws_vpc_id = {{ plat__aws_vpc_id }}" |
81 | | - |
82 | | -- name: Prompt added by jenright |
83 | | - pause: |
84 | | - prompt: "Check value of plat__aws_vpc_id" |
85 | | - when: debug_terraform | default(false) | bool |
86 | | - |
87 | 71 | - name: Discover AWS VPC Subnets |
88 | 72 | when: infra__aws_subnet_ids is undefined |
89 | 73 | block: |
|
95 | 79 | "tag:Name": "{{ plat__namespace }}*" |
96 | 80 | register: __aws_subnets_info |
97 | 81 |
|
98 | | - # NOTE: jenright I had to change this for Terraform created subnets, why? |
99 | 82 | - name: Set fact for AWS Subnet IDs |
100 | 83 | when: __aws_subnets_info is defined |
101 | 84 | ansible.builtin.set_fact: |
|
110 | 93 | ansible.builtin.set_fact: |
111 | 94 | plat__aws_subnet_ids: "{{ infra__aws_subnet_ids }}" |
112 | 95 |
|
113 | | -- name: jenright Debug value of plat__aws_subnet_ids |
114 | | - ansible.builtin.debug: |
115 | | - msg: |
116 | | - - "infra__aws_subnet_ids: {{ infra__aws_subnet_ids | default('BLANK') }}" |
117 | | - - "__aws_subnets_info: {{ __aws_subnets_info | default('BLANK') }}" |
118 | | - - "plat__aws_subnet_ids: {{ plat__aws_subnet_ids | default('BLANK') }}" |
119 | | - |
120 | | -- name: Prompt added by jenright |
121 | | - pause: |
122 | | - prompt: "Check value of plat__aws_subnet_ids" |
123 | | - when: debug_terraform | default(false) | bool |
124 | | - |
125 | 96 | - name: Set public subnets for public endpoint access |
126 | 97 | when: plat__public_endpoint_access |
127 | 98 | block: |
128 | 99 | - name: Discover AWS Public Subnets |
129 | 100 | when: infra__aws_public_subnet_ids is not defined |
130 | | - block: |
131 | | - - name: Print infra__vpc_public_subnets_info names |
132 | | - debug: |
133 | | - msg: |
134 | | - - "{{ item }}" |
135 | | - loop: "{{ infra__vpc_public_subnets_info | map(attribute='name' ) }}" |
136 | | - |
| 101 | + block: |
137 | 102 | # TODO: Change infra__vpc_public_subnets_info to plat__vpc_public_subnets_info |
138 | 103 | - name: Query AWS Public Subnets |
139 | 104 | amazon.aws.ec2_vpc_subnet_info: |
|
143 | 108 | loop: "{{ infra__vpc_public_subnets_info | map(attribute='name' ) }}" |
144 | 109 | register: __aws_public_subnet_info |
145 | 110 |
|
146 | | - - name: jenright Debug Print Discover AWS Public Subnets |
147 | | - ansible.builtin.debug: |
148 | | - msg: |
149 | | - # - "{{ __aws_public_subnet_info }}" |
150 | | - - "{{ __aws_public_subnet_info.results | community.general.json_query('[*].subnets[*].id') | flatten }}" |
151 | | - |
152 | 111 | - name: Set fact for AWS Public Subnets |
153 | 112 | ansible.builtin.set_fact: |
154 | | - # plat__aws_public_subnet_ids: "{{ __aws_public_subnet_info.subnets|map(attribute='id')| list }}" |
155 | 113 | plat__aws_public_subnet_ids: "{{ __aws_public_subnet_info.results | community.general.json_query('[*].subnets[*].id') | flatten }}" |
156 | 114 | plat__endpoint_access_scheme: "PUBLIC" |
157 | 115 |
|
|
161 | 119 | plat__aws_public_subnet_ids: "{{ infra__aws_public_subnet_ids }}" |
162 | 120 | plat__endpoint_access_scheme: "PUBLIC" |
163 | 121 |
|
164 | | -- name: jenright Debug Final Value of plat__aws_public_subnet_ids |
165 | | - ansible.builtin.debug: |
166 | | - var: plat__aws_public_subnet_ids |
167 | | - |
168 | | -- name: Prompt added by jenright |
169 | | - pause: |
170 | | - prompt: "Check value of AWS Public Subnets" |
171 | | - when: debug_terraform | default(false) | bool |
172 | | - |
173 | 122 | - name: Discover AWS Security Group for Knox |
174 | 123 | when: infra__aws_security_group_knox_id is undefined |
175 | 124 | block: |
|
0 commit comments