Debian Codegraph @

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

raw
1 ---
2 # ----------------------------------------------------------------------------
3 #
4 # *** AUTO GENERATED CODE *** Type: MMv1 ***
5 #
6 # ----------------------------------------------------------------------------
7 #
8 # This file is automatically generated by Magic Modules and manual
9 # changes will be clobbered when the file is regenerated.
10 #
11 # Please read more about how to change this file at
12 # https://www.github.com/GoogleCloudPlatform/magic-modules
13 #
14 # ----------------------------------------------------------------------------
15 # Pre-test setup
16 - name: Create a instance
17 google.cloud.gcp_spanner_instance:
18 name: instance-database
19 display_name: My Spanner Instance
20 node_count: 2
21 labels:
22 cost_center: ti-1700004
23 config: regional-us-central1
24 project: "{{ gcp_project }}"
25 auth_kind: "{{ gcp_cred_kind }}"
26 service_account_file: "{{ gcp_cred_file | default(omit) }}"
27 state: present
28 register: instance
29 - name: Delete a database
30 google.cloud.gcp_spanner_database:
31 name: webstore
32 instance: "{{ instance }}"
33 project: "{{ gcp_project }}"
34 auth_kind: "{{ gcp_cred_kind }}"
35 service_account_file: "{{ gcp_cred_file | default(omit) }}"
36 state: absent
37 # ----------------------------------------------------------
38 - name: Create a database
39 google.cloud.gcp_spanner_database:
40 name: webstore
41 instance: "{{ instance }}"
42 project: "{{ gcp_project }}"
43 auth_kind: "{{ gcp_cred_kind }}"
44 service_account_file: "{{ gcp_cred_file | default(omit) }}"
45 state: present
46 register: result
47 - name: Assert changed is true
48 ansible.builtin.assert:
49 that:
50 - result.changed == true
51 # - name: verify that database was created
52 # google.cloud.gcp_spanner_database_info:
53 # instance: "{{ instance }}"
54 # project: "{{ gcp_project }}"
55 # auth_kind: "{{ gcp_cred_kind }}"
56 # service_account_file: "{{ gcp_cred_file | default(omit) }}"
57 # scopes:
58 # - https://www.googleapis.com/auth/spanner.admin
59 # register: results
60 # - name: verify that command succeeded
61 # assert:
62 # that:
63 # - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1
64 # ----------------------------------------------------------------------------
65 - name: Create a database that already exists
66 google.cloud.gcp_spanner_database:
67 name: webstore
68 instance: "{{ instance }}"
69 project: "{{ gcp_project }}"
70 auth_kind: "{{ gcp_cred_kind }}"
71 service_account_file: "{{ gcp_cred_file | default(omit) }}"
72 state: present
73 register: result
74 - name: Assert changed is false
75 ansible.builtin.assert:
76 that:
77 - result.changed == false
78 # ----------------------------------------------------------
79 - name: Delete a database
80 google.cloud.gcp_spanner_database:
81 name: webstore
82 instance: "{{ instance }}"
83 project: "{{ gcp_project }}"
84 auth_kind: "{{ gcp_cred_kind }}"
85 service_account_file: "{{ gcp_cred_file | default(omit) }}"
86 state: absent
87 register: result
88 - name: Assert changed is true
89 ansible.builtin.assert:
90 that:
91 - result.changed == true
92 # commented out due to a flakey List endpoint
93 # on the spanner API. (requests continue to return
94 # 404s intermittently).
95 # uncomment if it's desired to test the info.
96 # - name: verify that database was deleted
97 # google.cloud.gcp_spanner_database_info:
98 # instance: "{{ instance }}"
99 # project: "{{ gcp_project }}"
100 # auth_kind: "{{ gcp_cred_kind }}"
101 # service_account_file: "{{ gcp_cred_file | default(omit) }}"
102 # scopes:
103 # - https://www.googleapis.com/auth/spanner.admin
104 # register: results
105 # - name: verify that command succeeded
106 # assert:
107 # that:
108 # - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0
109 # ----------------------------------------------------------------------------
110 - name: Delete a database that does not exist
111 google.cloud.gcp_spanner_database:
112 name: webstore
113 instance: "{{ instance }}"
114 project: "{{ gcp_project }}"
115 auth_kind: "{{ gcp_cred_kind }}"
116 service_account_file: "{{ gcp_cred_file | default(omit) }}"
117 state: absent
118 register: result
119 - name: Assert changed is false
120 ansible.builtin.assert:
121 that:
122 - result.changed == false
123 # ---------------------------------------------------------
124 # Post-test teardown
125 # If errors happen, don't crash the playbook!
126 - name: Delete a instance
127 google.cloud.gcp_spanner_instance:
128 name: instance-database
129 display_name: My Spanner Instance
130 node_count: 2
131 labels:
132 cost_center: ti-1700004
133 config: regional-us-central1
134 project: "{{ gcp_project }}"
135 auth_kind: "{{ gcp_cred_kind }}"
136 service_account_file: "{{ gcp_cred_file | default(omit) }}"
137 state: absent
138 register: instance
139 ignore_errors: true