Debian Codegraph @

ansible_collections/google/cloud/tests/integration/targets/gcp_runtimeconfig_variable/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 config
17 google.cloud.gcp_runtimeconfig_config:
18 name: my-config
19 description: My config
20 project: "{{ gcp_project }}"
21 auth_kind: "{{ gcp_cred_kind }}"
22 service_account_file: "{{ gcp_cred_file | default(omit) }}"
23 state: present
24 register: config
25 - name: Delete a variable
26 google.cloud.gcp_runtimeconfig_variable:
27 name: prod-variables/hostname
28 config: my-config
29 text: example.com
30 project: "{{ gcp_project }}"
31 auth_kind: "{{ gcp_cred_kind }}"
32 service_account_file: "{{ gcp_cred_file | default(omit) }}"
33 state: absent
34 # ----------------------------------------------------------
35 - name: Create a variable
36 google.cloud.gcp_runtimeconfig_variable:
37 name: prod-variables/hostname
38 config: my-config
39 text: example.com
40 project: "{{ gcp_project }}"
41 auth_kind: "{{ gcp_cred_kind }}"
42 service_account_file: "{{ gcp_cred_file | default(omit) }}"
43 state: present
44 register: result
45 - name: Assert changed is true
46 ansible.builtin.assert:
47 that:
48 - result.changed == true
49 - name: Verify that variable was created
50 google.cloud.gcp_runtimeconfig_variable_info:
51 config: my-config
52 project: "{{ gcp_project }}"
53 auth_kind: "{{ gcp_cred_kind }}"
54 service_account_file: "{{ gcp_cred_file | default(omit) }}"
55 scopes:
56 - https://www.googleapis.com/auth/cloudruntimeconfig
57 register: results
58 - name: Verify that command succeeded
59 ansible.builtin.assert:
60 that:
61 - results['resources'] | map(attribute='name') | select("match", ".*prod-variables/hostname.*") | list | length == 1
62 # ----------------------------------------------------------------------------
63 - name: Create a variable that already exists
64 google.cloud.gcp_runtimeconfig_variable:
65 name: prod-variables/hostname
66 config: my-config
67 text: example.com
68 project: "{{ gcp_project }}"
69 auth_kind: "{{ gcp_cred_kind }}"
70 service_account_file: "{{ gcp_cred_file | default(omit) }}"
71 state: present
72 register: result
73 - name: Assert changed is false
74 ansible.builtin.assert:
75 that:
76 - result.changed == false
77 # ----------------------------------------------------------
78 - name: Delete a variable
79 google.cloud.gcp_runtimeconfig_variable:
80 name: prod-variables/hostname
81 config: my-config
82 text: example.com
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 - name: Verify that variable was deleted
93 google.cloud.gcp_runtimeconfig_variable_info:
94 config: my-config
95 project: "{{ gcp_project }}"
96 auth_kind: "{{ gcp_cred_kind }}"
97 service_account_file: "{{ gcp_cred_file | default(omit) }}"
98 scopes:
99 - https://www.googleapis.com/auth/cloudruntimeconfig
100 register: results
101 - name: Verify that command succeeded
102 ansible.builtin.assert:
103 that:
104 - results['resources'] | map(attribute='name') | select("match", ".*prod-variables/hostname.*") | list | length == 0
105 # ----------------------------------------------------------------------------
106 - name: Delete a variable that does not exist
107 google.cloud.gcp_runtimeconfig_variable:
108 name: prod-variables/hostname
109 config: my-config
110 text: example.com
111 project: "{{ gcp_project }}"
112 auth_kind: "{{ gcp_cred_kind }}"
113 service_account_file: "{{ gcp_cred_file | default(omit) }}"
114 state: absent
115 register: result
116 - name: Assert changed is false
117 ansible.builtin.assert:
118 that:
119 - result.changed == false
120 # ---------------------------------------------------------
121 # Post-test teardown
122 # If errors happen, don't crash the playbook!
123 - name: Delete a config
124 google.cloud.gcp_runtimeconfig_config:
125 name: my-config
126 description: My config
127 project: "{{ gcp_project }}"
128 auth_kind: "{{ gcp_cred_kind }}"
129 service_account_file: "{{ gcp_cred_file | default(omit) }}"
130 state: absent
131 register: config
132 ignore_errors: true