Debian Codegraph @

ansible_collections/community/zabbix/tests/integration/targets/test_zabbix_globalmacro/tasks/main.yml

raw
1 ---
2 - name: test - attempt to create new global macro
3 community.zabbix.zabbix_globalmacro:
4 macro_name: zbxgmacro_test01
5 macro_value: 123
6 macro_type: text
7 macro_description: Global Macro description
8 register: zbxgmacro_new
9
10 - name: assert that macro was created
11 ansible.builtin.assert:
12 that: zbxgmacro_new is changed
13
14 - name: test - attempt to create same global macro
15 community.zabbix.zabbix_globalmacro:
16 macro_name: zbxgmacro_test01
17 macro_value: 123
18 macro_type: text
19 macro_description: Global Macro description
20 register: zbxgmacro_existing
21
22 - name: assert that nothing has been changed
23 ansible.builtin.assert:
24 that: not zbxgmacro_existing is changed
25
26 - name: test - attempt to create same global macro in zabbix native format
27 community.zabbix.zabbix_globalmacro:
28 macro_name: "{$zbxgmacro_test01}"
29 macro_value: 123
30 macro_type: text
31 macro_description: Global Macro description
32 register: zbxgmacro_existing_native
33
34 - name: assert that nothing has been changed
35 ansible.builtin.assert:
36 that: not zbxgmacro_existing_native is changed
37
38 - name: test - attempt to create new global macro in zabbix native format
39 community.zabbix.zabbix_globalmacro:
40 macro_name: "{$ZBXGMACRO_TEST02}"
41 macro_value: abcd
42 macro_type: text
43 register: zbxgmacro_new_native
44
45 - name: assert that nothing macro was created
46 ansible.builtin.assert:
47 that: zbxgmacro_new_native is changed
48
49 - name: test - attempt to update global macro with string value while force=no
50 community.zabbix.zabbix_globalmacro:
51 macro_name: zbxgmacro_test01
52 macro_value: abc
53 macro_type: text
54 force: false
55 register: zbxgmacro_update_noforce
56
57 - name: assert that nothing has been changed
58 ansible.builtin.assert:
59 that: not zbxgmacro_update_noforce is changed
60
61 - name: test - attempt to update global macro with string value
62 community.zabbix.zabbix_globalmacro:
63 macro_name: zbxgmacro_test01
64 macro_value: abc
65 macro_type: text
66 register: zbxgmacro_update
67
68 - name: assert that global macro was updated
69 ansible.builtin.assert:
70 that: zbxgmacro_update is changed
71
72 - name: test - attempt to create global macro with context
73 community.zabbix.zabbix_globalmacro:
74 macro_name: low_space_limit:/home
75 macro_value: 10
76 macro_type: text
77 register: zbxgmacro_context_new
78
79 - name: assert that macro was created
80 ansible.builtin.assert:
81 that: zbxgmacro_context_new is changed
82
83 - name: test - attempt to create same global macro with context and verify that it was converted to uppercase
84 community.zabbix.zabbix_globalmacro:
85 macro_name: LOW_SPACE_LIMIT:/home
86 macro_value: 10
87 macro_type: text
88 register: zbxgmacro_context_existing
89
90 - name: assert that nothing has been changed
91 ansible.builtin.assert:
92 that: not zbxgmacro_context_existing is changed
93
94 - name: test - attempt to delete all global macros
95 community.zabbix.zabbix_globalmacro:
96 macro_name: "{{ item }}"
97 state: absent
98 loop:
99 - zbxgmacro_test01
100 - LOW_SPACE_LIMIT:/home
101 - "{$ZBXGMACRO_TEST02}"
102 register: zbxgmacro_delete_existing
103
104 - name: assert that all macros have been deleted
105 ansible.builtin.assert:
106 that: item.changed is sameas True
107 loop: "{{ zbxgmacro_delete_existing.results }}"
108
109 - name: test - attempt to delete non-existing global macro
110 community.zabbix.zabbix_globalmacro:
111 macro_name: zbxgmacro_test01
112 state: absent
113 register: zbxgmacro_delete_missing
114
115 - name: assert that nothing has been changed
116 ansible.builtin.assert:
117 that: not zbxgmacro_delete_missing is changed
118
119 - name: test - attempt to create secret global macro
120 community.zabbix.zabbix_globalmacro:
121 macro_name: zbxgmacro_test_secret
122 macro_value: 123
123 macro_type: secret
124 macro_description: Global Macro description
125 register: zbxgmacro_secret
126
127 - ansible.builtin.assert:
128 that: zbxgmacro_secret.changed is sameas True
129
130 - name: test - attempt to create same global macro
131 community.zabbix.zabbix_globalmacro:
132 macro_name: zbxgmacro_test_secret
133 macro_value: 123
134 macro_type: secret
135 macro_description: Global Macro description
136 register: zbxgmacro_secret
137
138 - ansible.builtin.assert:
139 that: zbxgmacro_secret.changed is sameas True
140
141 - name: test - attempt to create vault global macro
142 community.zabbix.zabbix_globalmacro:
143 macro_name: zbxgmacro_test_vault
144 macro_value: path/to/vault:zabbix
145 macro_type: vault
146 macro_description: Global Macro description
147 register: zbxgmacro_vault
148
149 - ansible.builtin.assert:
150 that: zbxgmacro_vault.changed is sameas True
151
152 - name: test - attempt to create same global macro
153 community.zabbix.zabbix_globalmacro:
154 macro_name: zbxgmacro_test_vault
155 macro_value: path/to/vault:zabbix
156 macro_type: vault
157 macro_description: Global Macro description
158 register: zbxgmacro_vault
159
160 - ansible.builtin.assert:
161 that: zbxgmacro_vault.changed is sameas False
162
163 - name: delete all global macros
164 community.zabbix.zabbix_globalmacro:
165 macro_name: "{{ item }}"
166 state: absent
167 loop:
168 - zbxgmacro_test_secret
169 - zbxgmacro_test_vault