Debian Codegraph @

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

raw symbols SCIP
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: Delete a firewall
17 google.cloud.gcp_compute_firewall:
18 name: "{{ resource_name }}"
19 allowed:
20 - ip_protocol: tcp
21 ports:
22 - "22"
23 target_tags:
24 - test-ssh-server
25 - staging-ssh-server
26 source_tags:
27 - test-ssh-clients
28 project: "{{ gcp_project }}"
29 auth_kind: "{{ gcp_cred_kind }}"
30 service_account_file: "{{ gcp_cred_file | default(omit) }}"
31 state: absent
32 # ----------------------------------------------------------
33 - name: Create a firewall
34 google.cloud.gcp_compute_firewall:
35 name: "{{ resource_name }}"
36 allowed:
37 - ip_protocol: tcp
38 ports:
39 - "22"
40 target_tags:
41 - test-ssh-server
42 - staging-ssh-server
43 source_tags:
44 - test-ssh-clients
45 project: "{{ gcp_project }}"
46 auth_kind: "{{ gcp_cred_kind }}"
47 service_account_file: "{{ gcp_cred_file | default(omit) }}"
48 state: present
49 register: result
50 - name: Assert changed is true
51 ansible.builtin.assert:
52 that:
53 - result.changed == true
54 - name: Verify that firewall was created
55 google.cloud.gcp_compute_firewall_info:
56 filters:
57 - name = {{ resource_name }}
58 project: "{{ gcp_project }}"
59 auth_kind: "{{ gcp_cred_kind }}"
60 service_account_file: "{{ gcp_cred_file | default(omit) }}"
61 scopes:
62 - https://www.googleapis.com/auth/compute
63 register: results
64 - name: Verify that command succeeded
65 ansible.builtin.assert:
66 that:
67 - results['resources'] | length == 1
68 # ----------------------------------------------------------------------------
69 - name: Create a firewall that already exists
70 google.cloud.gcp_compute_firewall:
71 name: "{{ resource_name }}"
72 allowed:
73 - ip_protocol: tcp
74 ports:
75 - "22"
76 target_tags:
77 - test-ssh-server
78 - staging-ssh-server
79 source_tags:
80 - test-ssh-clients
81 project: "{{ gcp_project }}"
82 auth_kind: "{{ gcp_cred_kind }}"
83 service_account_file: "{{ gcp_cred_file | default(omit) }}"
84 state: present
85 register: result
86 - name: Assert changed is false
87 ansible.builtin.assert:
88 that:
89 - result.changed == false
90 # ----------------------------------------------------------
91 - name: Delete a firewall
92 google.cloud.gcp_compute_firewall:
93 name: "{{ resource_name }}"
94 allowed:
95 - ip_protocol: tcp
96 ports:
97 - "22"
98 target_tags:
99 - test-ssh-server
100 - staging-ssh-server
101 source_tags:
102 - test-ssh-clients
103 project: "{{ gcp_project }}"
104 auth_kind: "{{ gcp_cred_kind }}"
105 service_account_file: "{{ gcp_cred_file | default(omit) }}"
106 state: absent
107 register: result
108 - name: Assert changed is true
109 ansible.builtin.assert:
110 that:
111 - result.changed == true
112 - name: Verify that firewall was deleted
113 google.cloud.gcp_compute_firewall_info:
114 filters:
115 - name = {{ resource_name }}
116 project: "{{ gcp_project }}"
117 auth_kind: "{{ gcp_cred_kind }}"
118 service_account_file: "{{ gcp_cred_file | default(omit) }}"
119 scopes:
120 - https://www.googleapis.com/auth/compute
121 register: results
122 - name: Verify that command succeeded
123 ansible.builtin.assert:
124 that:
125 - results['resources'] | length == 0
126 # ----------------------------------------------------------------------------
127 - name: Delete a firewall that does not exist
128 google.cloud.gcp_compute_firewall:
129 name: "{{ resource_name }}"
130 allowed:
131 - ip_protocol: tcp
132 ports:
133 - "22"
134 target_tags:
135 - test-ssh-server
136 - staging-ssh-server
137 source_tags:
138 - test-ssh-clients
139 project: "{{ gcp_project }}"
140 auth_kind: "{{ gcp_cred_kind }}"
141 service_account_file: "{{ gcp_cred_file | default(omit) }}"
142 state: absent
143 register: result
144 - name: Assert changed is false
145 ansible.builtin.assert:
146 that:
147 - result.changed == false