Debian Codegraph @

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

raw
1 ---
2 - name: Create FTP Service Template
3 community.zabbix.zabbix_template:
4 template_name: FTP Service
5 template_groups:
6 - "Templates"
7 state: present
8
9 - name: test - import Zabbix template from JSON
10 community.zabbix.zabbix_configuration:
11 content_json: "{{ lookup('file', 'template.json') }}"
12 rules:
13 templates:
14 createMissing: true
15 updateExisting: true
16 items:
17 createMissing: true
18 updateExisting: true
19 deleteMissing: true
20 triggers:
21 createMissing: true
22 updateExisting: true
23 deleteMissing: true
24 valueMaps:
25 createMissing: true
26 updateExisting: false
27 templateLinkage:
28 createMissing: true
29 register: zbxconfiguration_import
30
31 - name: assert that configuration was imported
32 ansible.builtin.assert:
33 that:
34 - zbxconfiguration_import.changed is sameas True
35
36 - name: test - import Zabbix template from JSON (not changed)
37 community.zabbix.zabbix_configuration:
38 content_json: "{{ lookup('file', 'template.json') }}"
39 rules:
40 templates:
41 createMissing: true
42 updateExisting: true
43 items:
44 createMissing: true
45 updateExisting: true
46 deleteMissing: true
47 triggers:
48 createMissing: true
49 updateExisting: true
50 deleteMissing: true
51 valueMaps:
52 createMissing: true
53 updateExisting: false
54 templateLinkage:
55 createMissing: true
56 register: zbxconfiguration_import
57
58 - name: assert that configuration was imported (not changed)
59 ansible.builtin.assert:
60 that:
61 - zbxconfiguration_import.changed is sameas False
62
63 - name: test - import Zabbix template from XML
64 community.zabbix.zabbix_configuration:
65 content_xml: "{{ lookup('file', 'template.xml') }}"
66 rules:
67 templates:
68 createMissing: true
69 updateExisting: true
70 items:
71 createMissing: true
72 updateExisting: true
73 deleteMissing: true
74 triggers:
75 createMissing: true
76 updateExisting: true
77 deleteMissing: true
78 valueMaps:
79 createMissing: true
80 updateExisting: false
81 register: zbxconfiguration_import
82
83 - name: assert that configuration was imported
84 ansible.builtin.assert:
85 that:
86 - zbxconfiguration_import.changed is sameas True
87
88 - name: test - import Zabbix template from XML (not changed)
89 community.zabbix.zabbix_configuration:
90 content_xml: "{{ lookup('file', 'template.xml') }}"
91 rules:
92 templates:
93 createMissing: true
94 updateExisting: true
95 items:
96 createMissing: true
97 updateExisting: true
98 deleteMissing: true
99 triggers:
100 createMissing: true
101 updateExisting: true
102 deleteMissing: true
103 valueMaps:
104 createMissing: true
105 updateExisting: false
106 register: zbxconfiguration_import
107
108 - name: assert that configuration was imported (not changed)
109 ansible.builtin.assert:
110 that:
111 - zbxconfiguration_import.changed is sameas False
112
113 - name: test - import Zabbix template from YAML
114 community.zabbix.zabbix_configuration:
115 content_yaml: "{{ lookup('file', 'template.yaml') }}"
116 rules:
117 templates:
118 createMissing: true
119 updateExisting: true
120 items:
121 createMissing: true
122 updateExisting: true
123 deleteMissing: true
124 triggers:
125 createMissing: true
126 updateExisting: true
127 deleteMissing: true
128 valueMaps:
129 createMissing: true
130 updateExisting: false
131 register: zbxconfiguration_import
132
133 - name: assert that configuration was imported
134 ansible.builtin.assert:
135 that:
136 - zbxconfiguration_import.changed is sameas True
137
138 - name: test - import Zabbix template from YAML (not changed)
139 community.zabbix.zabbix_configuration:
140 content_yaml: "{{ lookup('file', 'template.yaml') }}"
141 rules:
142 templates:
143 createMissing: true
144 updateExisting: true
145 items:
146 createMissing: true
147 updateExisting: true
148 deleteMissing: true
149 triggers:
150 createMissing: true
151 updateExisting: true
152 deleteMissing: true
153 valueMaps:
154 createMissing: true
155 updateExisting: false
156 register: zbxconfiguration_import
157
158 - name: assert that configuration was imported (not changed)
159 ansible.builtin.assert:
160 that:
161 - zbxconfiguration_import.changed is sameas False
162
163 - name: Delete Zabbix template
164 community.zabbix.zabbix_template:
165 template_name: "{{ item }}"
166 state: absent
167 loop:
168 - ExampleTemplateJSON
169 - ExampleTemplateXML
170 - ExampleTemplateYAML
171 - FTP Service