You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: roles/platform/tasks/initialize_setup_gcp.yml
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,25 @@
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
+
- name: Discover available zones for GCP region
18
+
block:
19
+
- name: Fetch list of availability zones filtered by region
20
+
ansible.builtin.command: >
21
+
gcloud compute zones list --filter region={{ plat__region }} --format json
22
+
register: __gcp_availability_zones_info
23
+
24
+
- name: Set fact for GCP availability zones
25
+
ansible.builtin.set_fact:
26
+
plat__gcp_availability_zones_discovered: "{{ __gcp_availability_zones_info.stdout | from_json | map(attribute='name') | list }}"
27
+
28
+
- name: Confirm availability zone access for CDP Environment
29
+
when: plat__gcp_availability_zones | length > 0
30
+
ansible.builtin.assert:
31
+
that:
32
+
- plat__gcp_availability_zones is subset(plat__gcp_availability_zones_discovered)
33
+
fail_msg: "The following zone(s) are not available in region '{{ plat__region }}': {{ plat__gcp_availability_zones | difference(plat__gcp_availability_zones_discovered) | join(', ') }}"
0 commit comments