Debian Codegraph @

ansible_collections/google/cloud/tests/integration/targets/gcp_alloydb_cluster/tasks/autogen.yml

raw symbols SCIP
1 # ----------------------------------------------------------------------------
2 #
3 # *** AUTO GENERATED CODE *** Type: MMv1 ***
4 #
5 # ----------------------------------------------------------------------------
6 #
7 # This file is automatically generated by Magic Modules and manual
8 # changes will be clobbered when the file is regenerated.
9 #
10 # ----------------------------------------------------------------------------
11 - name: Main test block
12 block:
13 - name: Create test network
14 google.cloud.gcp_compute_network:
15 name: "{{ resource_name }}"
16 state: present
17 auto_create_subnetworks: true
18 project: "{{ gcp_project }}"
19 auth_kind: "{{ gcp_cred_kind }}"
20 service_account_file: "{{ gcp_cred_file }}"
21 register: _network
22
23 - name: Test case
24 block:
25 - name: Create primary alloydb cluster
26 google.cloud.gcp_alloydb_cluster:
27 cluster_id: "{{ resource_name }}-primary"
28 state: present
29 location: us-central1
30 cluster_type: PRIMARY
31 initial_user:
32 user: pgroot
33 password: Test123Test
34 network_config:
35 network: "projects/{{ gcp_project_number }}/global/networks/{{ resource_name }}"
36 project: "{{ gcp_project }}"
37 auth_kind: "{{ gcp_cred_kind }}"
38 service_account_file: "{{ gcp_cred_file }}"
39 register: _primary
40
41 - name: Create secondary cluster attached to primary
42 google.cloud.gcp_alloydb_cluster:
43 cluster_id: "{{ resource_name }}-secondary"
44 state: present
45 location: us-central1
46 cluster_type: SECONDARY
47 network_config:
48 network: "projects/{{ gcp_project_number }}/global/networks/{{ resource_name }}"
49 secondary_config:
50 primary_cluster_name: "{{ _primary.name }}"
51 project: "{{ gcp_project }}"
52 auth_kind: "{{ gcp_cred_kind }}"
53 service_account_file: "{{ gcp_cred_file }}"
54 register: _secondary
55
56 - name: Run assertions
57 ansible.builtin.assert:
58 that:
59 - _primary.changed == true
60 - _primary.clusterType == "PRIMARY"
61 - _secondary.changed == true
62 - _secondary.clusterType == "SECONDARY"
63 - _secondary.secondaryConfig.primaryClusterName == _primary.name
64
65 always:
66 - name: Delete secondary cluster
67 google.cloud.gcp_alloydb_cluster:
68 cluster_id: "{{ resource_name }}-secondary"
69 state: absent
70 location: us-central1
71 project: "{{ gcp_project }}"
72 auth_kind: "{{ gcp_cred_kind }}"
73 service_account_file: "{{ gcp_cred_file }}"
74
75 - name: Delete primary cluster
76 google.cloud.gcp_alloydb_cluster:
77 cluster_id: "{{ resource_name }}-primary"
78 state: absent
79 location: us-central1
80 project: "{{ gcp_project }}"
81 auth_kind: "{{ gcp_cred_kind }}"
82 service_account_file: "{{ gcp_cred_file }}"
83
84 always:
85 - name: Destroy test network
86 google.cloud.gcp_compute_network:
87 name: "{{ resource_name }}"
88 state: absent
89 project: "{{ gcp_project }}"
90 auth_kind: "{{ gcp_cred_kind }}"
91 service_account_file: "{{ gcp_cred_file }}"