summaryrefslogtreecommitdiff
path: root/test/integration/targets/incidental_zabbix_host
diff options
context:
space:
mode:
authorMatt Clay <mclay@redhat.com>2020-02-28 20:37:50 -0800
committerGitHub <noreply@github.com>2020-02-28 20:37:50 -0800
commit7c8b046b5fac7342fcf7882d4c84efc089e7866f (patch)
tree22c3b9ac4cb671951e7f20457269f63c1caf91f8 /test/integration/targets/incidental_zabbix_host
parent04666c9fa1eb2f367cf3b1c9c6853828bdcb813f (diff)
downloadansible-7c8b046b5fac7342fcf7882d4c84efc089e7866f.tar.gz
Fourth batch of incidental integration tests. (#67873)
* Copy in incidental posix tests. * Update incidental test aliases. * Update target names. * Add support plugins. * Fix paths. * Update ignores. * Update integration-aliases sanity test. * Add incidental tests to CI.
Diffstat (limited to 'test/integration/targets/incidental_zabbix_host')
-rw-r--r--test/integration/targets/incidental_zabbix_host/aliases6
-rw-r--r--test/integration/targets/incidental_zabbix_host/defaults/main.yml5
-rw-r--r--test/integration/targets/incidental_zabbix_host/meta/main.yml2
-rw-r--r--test/integration/targets/incidental_zabbix_host/tasks/main.yml16
-rw-r--r--test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_doc.yml83
-rw-r--r--test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_setup.yml20
-rw-r--r--test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_teardown.yml10
-rw-r--r--test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_tests.yml1169
8 files changed, 1311 insertions, 0 deletions
diff --git a/test/integration/targets/incidental_zabbix_host/aliases b/test/integration/targets/incidental_zabbix_host/aliases
new file mode 100644
index 0000000000..f89752b833
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/aliases
@@ -0,0 +1,6 @@
+destructive
+shippable/posix/incidental
+skip/aix
+skip/osx
+skip/freebsd
+skip/rhel
diff --git a/test/integration/targets/incidental_zabbix_host/defaults/main.yml b/test/integration/targets/incidental_zabbix_host/defaults/main.yml
new file mode 100644
index 0000000000..5482107368
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/defaults/main.yml
@@ -0,0 +1,5 @@
+---
+
+zabbix_server_url: http://127.0.0.1/zabbix/
+zabbix_login_user: Admin
+zabbix_login_password: zabbix
diff --git a/test/integration/targets/incidental_zabbix_host/meta/main.yml b/test/integration/targets/incidental_zabbix_host/meta/main.yml
new file mode 100644
index 0000000000..df12e5e785
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - incidental_setup_zabbix
diff --git a/test/integration/targets/incidental_zabbix_host/tasks/main.yml b/test/integration/targets/incidental_zabbix_host/tasks/main.yml
new file mode 100644
index 0000000000..914c1e5fcf
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/tasks/main.yml
@@ -0,0 +1,16 @@
+---
+# setup stuff not testing zabbix_host
+- block:
+ - include: zabbix_host_setup.yml
+
+ # zabbix_host module tests
+ - include: zabbix_host_tests.yml
+
+ # documentation example tests
+ - include: zabbix_host_doc.yml
+
+ # tear down stuff set up earlier
+ - include: zabbix_host_teardown.yml
+
+ when:
+ - ansible_distribution == 'Ubuntu'
diff --git a/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_doc.yml b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_doc.yml
new file mode 100644
index 0000000000..40f702bb45
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_doc.yml
@@ -0,0 +1,83 @@
+---
+# These two tests are close to documentation example
+
+- name: Create a new host or update an existing host's info
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost1
+ visible_name: ExampleName
+ description: My ExampleHost Description
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ status: enabled
+ state: present
+ inventory_mode: manual
+ inventory_zabbix:
+ tag: test-tag
+ alias: test-alias
+ notes: "Special Informations: test-info"
+ location: test-location
+ site_rack: test-rack
+ os: test-os
+ hardware: test-hw
+ ipmi_authtype: 2
+ ipmi_privilege: 4
+ ipmi_username: username
+ ipmi_password: password
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ - type: 4
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "12345"
+ macros:
+ - macro: '{$EXAMPLEMACRO}'
+ value: ExampleMacroValue
+ - macro: EXAMPLEMACRO2
+ value: ExampleMacroValue2
+ description: Example desc that work only with Zabbix 4.4 and higher
+ tags:
+ - tag: ExampleHostsTag
+ - tag: ExampleHostsTag2
+ value: ExampleTagValue
+ register: zabbix_host1
+
+- name: Update an existing host's tls settings
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost2
+ visible_name: ExampleName2
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.2
+ dns: ""
+ port: "10050"
+ host_groups:
+ - Linux servers
+ tls_psk_identity: test
+ tls_connect: 2
+ tls_psk: 123456789abcdef123456789abcdef12
+ register: zabbix_host2
+
+- name: expect both to succeed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+ - "zabbix_host2 is changed"
diff --git a/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_setup.yml b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_setup.yml
new file mode 100644
index 0000000000..498a725f29
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_setup.yml
@@ -0,0 +1,20 @@
+---
+# set up a zabbix proxy to test zabbix_host with
+
+- name: Create a new proxy
+ zabbix_proxy:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ proxy_name: ExampleProxy
+ description: ExampleProxy
+ status: active
+ state: present
+ interface:
+ type: 0
+ main: 1
+ useip: 1
+ ip: 10.5.6.7
+ dns: ""
+ port: 10050
+ register: zabbix_proxy
diff --git a/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_teardown.yml b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_teardown.yml
new file mode 100644
index 0000000000..1d76c516c7
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_teardown.yml
@@ -0,0 +1,10 @@
+---
+# remove zabbix_proxy (hopefully) created earlier
+
+- name: remove proxy
+ zabbix_proxy:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ proxy_name: ExampleProxy
+ state: absent
diff --git a/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_tests.yml b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_tests.yml
new file mode 100644
index 0000000000..63be018988
--- /dev/null
+++ b/test/integration/targets/incidental_zabbix_host/tasks/zabbix_host_tests.yml
@@ -0,0 +1,1169 @@
+---
+
+- name: "test: create host with many options set"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ visible_name: ExampleName
+ description: My ExampleHost Description
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ status: enabled
+ state: present
+ inventory_mode: manual
+ inventory_zabbix:
+ tag: test-tag
+ alias: test-alias
+ notes: "Special Informations: test-info"
+ location: test-location
+ site_rack: test-rack
+ os: test-os
+ hardware: test-hw
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ - type: 1
+ main: 0
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "{$MACRO}"
+ - type: 4
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "12345"
+ proxy: ExampleProxy
+ tls_psk_identity: test
+ tls_connect: 2
+ tls_psk: 123456789abcdef123456789abcdef12
+ macros:
+ - macro: MACRO1
+ value: test1
+ - macro: '{$MACRO2}'
+ value: test2
+ tags:
+ - tag: Tag1
+ - tag: Tag2
+ value: test2
+ register: zabbix_host1
+
+- name: expect to succeed and that things changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: try to create the same host with the same settings"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ visible_name: ExampleName
+ description: My ExampleHost Description
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ status: enabled
+ state: present
+ inventory_mode: manual
+ inventory_zabbix:
+ tag: test-tag
+ alias: test-alias
+ notes: "Special Informations: test-info"
+ location: test-location
+ site_rack: test-rack
+ os: test-os
+ hardware: test-hw
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ - type: 1
+ main: 0
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "{$MACRO}"
+ - type: 4
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "12345"
+ proxy: ExampleProxy
+ tls_psk_identity: test
+ tls_connect: 2
+ tls_psk: 123456789abcdef123456789abcdef12
+ macros:
+ - macro: MACRO1
+ value: test1
+ - macro: '{$MACRO2}'
+ value: test2
+ tags:
+ - tag: Tag1
+ - tag: Tag2
+ value: test2
+ register: zabbix_host1
+
+- name: updating with same values should be idempotent
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: try to create the same host with the same settings and force false"
+ zabbix_host:
+ force: false
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ visible_name: ExampleName
+ description: My ExampleHost Description
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ status: enabled
+ state: present
+ inventory_mode: manual
+ inventory_zabbix:
+ tag: test-tag
+ alias: test-alias
+ notes: "Special Informations: test-info"
+ location: test-location
+ site_rack: test-rack
+ os: test-os
+ hardware: test-hw
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ - type: 1
+ main: 0
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "{$MACRO}"
+ - type: 4
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "12345"
+ proxy: ExampleProxy
+ tls_psk_identity: test
+ tls_connect: 2
+ tls_psk: 123456789abcdef123456789abcdef12
+ register: zabbix_host1
+
+- name: updating with same values and force false should be idempotent
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: try to create the same host changing one parameter in the inventory with force false"
+ zabbix_host:
+ force: false
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ visible_name: ExampleName
+ description: My ExampleHost Description
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ status: enabled
+ state: present
+ inventory_mode: manual
+ inventory_zabbix:
+ tag: test-tag
+ alias: test-alias
+ notes: "Special Informations: test-info"
+ location: test-location
+ site_rack: test-rack
+ os: test-os
+ hardware: test-hw-modified
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ - type: 1
+ main: 0
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "{$MACRO}"
+ - type: 4
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "12345"
+ proxy: ExampleProxy
+ tls_psk_identity: test
+ tls_connect: 2
+ tls_psk: 123456789abcdef123456789abcdef12
+ register: zabbix_host1
+
+- name: changing the value of an already defined inventory should work and mark task as changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change visible_name"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ visible_name: "ExampleName Changed"
+ register: zabbix_host1
+
+- name: expect to succeed and that things changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change visible_name (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ visible_name: "ExampleName Changed"
+ register: zabbix_host1
+
+- name: updating with same values should be idempotent
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change description"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ description: "My ExampleHost Description Changed"
+ register: zabbix_host1
+
+- name: expect to succeed and that things changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change description (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ description: "My ExampleHost Description Changed"
+ register: zabbix_host1
+
+- name: updating with same values should be idempotent
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change host groups (adding one group)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ - Virtual machines
+ register: zabbix_host1
+
+- name: expect to succeed and that things changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host groups (remove one group)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ register: zabbix_host1
+
+- name: expect to succeed and that things changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host groups (add one group using force=no)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ host_groups:
+ - Virtual machines
+ force: no
+ register: zabbix_host1
+
+- name: expect to succeed and that things changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+
+- name: "test: change host groups (check whether we are at three groups)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ host_groups:
+ - Linux servers
+ - Zabbix servers
+ - Virtual machines
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change host groups (attempt to remove all host groups)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ host_groups:
+ -
+ register: zabbix_host1
+ ignore_errors: yes
+
+- name: expect to fail
+ assert:
+ that:
+ - "zabbix_host1 is failed"
+
+- name: "test: change host linked templates (same as before)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change host linked templates (add one template)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ - Template App HTTP Service
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host linked templates (add one template, using force=no)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ link_templates:
+ - Template App LDAP Service
+ force: no
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host linked templates (make sure we are at 4 templates)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ link_templates:
+ - Template App IMAP Service
+ - Template App NTP Service
+ - Template App HTTP Service
+ - Template App LDAP Service
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change host linked templates (remove all templates)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ link_templates:
+ -
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host linked templates (check we have no templates left)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ link_templates:
+ -
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change host status"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ status: disabled
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host status (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ status: disabled
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change host inventory mode"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ inventory_mode: automatic
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host inventory mode"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ inventory_mode: automatic
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change host inventory data (one field)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ inventory_zabbix:
+ tag: test-tag-two
+ alias: test-alias
+ notes: "Special Informations: test-info"
+ location: test-location
+ site_rack: test-rack
+ os: test-os
+ hardware: test-hw
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host inventory data (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ inventory_zabbix:
+ tag: test-tag-two
+ alias: test-alias
+ notes: "Special Informations: test-info"
+ location: test-location
+ site_rack: test-rack
+ os: test-os
+ hardware: test-hw
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: remove host proxy"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ proxy: ''
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add host proxy"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ proxy: ExampleProxy
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add host proxy (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ proxy: ExampleProxy
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change tls settings"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tls_psk_identity: test2
+ tls_connect: 4
+ tls_accept: 7
+ tls_psk: 123456789abcdef123456789abcdef13
+ tls_issuer: AcmeCorp
+ tls_subject: AcmeCorpServer
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change tls settings (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tls_psk_identity: test2
+ tls_connect: 4
+ tls_accept: 7
+ tls_psk: 123456789abcdef123456789abcdef13
+ tls_issuer: AcmeCorp
+ tls_subject: AcmeCorpServer
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change interface settings (remove one)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change interface settings (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: change interface settings (add one interface using force=no)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ interfaces:
+ - type: 4
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "12345"
+ force: no
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change interface settings (verify that we are at two interfaces)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "10050"
+ - type: 4
+ main: 1
+ useip: 1
+ ip: 10.1.1.1
+ dns: ""
+ port: "12345"
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "not zabbix_host1 is changed"
+
+- name: "test: add IPMI settings"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ ipmi_authtype: 2
+ ipmi_privilege: 4
+ ipmi_username: username
+ ipmi_password: password
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add IPMI settings again"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ ipmi_authtype: 2
+ ipmi_privilege: 4
+ ipmi_username: username
+ ipmi_password: password
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: verify that an empty change is idempotent"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: IPMI set default values"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ ipmi_authtype: -1
+ ipmi_privilege: 2
+ ipmi_username: ""
+ ipmi_password: ""
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: IPMI set default values (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ ipmi_authtype: -1
+ ipmi_privilege: 2
+ ipmi_username: ""
+ ipmi_password: ""
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: change host inventory mode to disabled"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ inventory_mode: disabled
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: change host inventory mode to manual"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ inventory_mode: manual
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add new set of user macros to the host"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros:
+ - macro: '{$NEWMACRO1}'
+ value: test123
+ - macro: NEWMACRO2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add new set of user macros to the host (again - lowercase)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros:
+ - macro: '{$newmacro1}'
+ value: test123
+ - macro: newmacro2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: update one of the user macros present on the host"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros:
+ - macro: '{$NEWMACRO1}'
+ value: test1234
+ - macro: NEWMACRO2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: update one of the user macros with description"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros:
+ - macro: '{$NEWMACRO1}'
+ value: test1234
+ description: Example Description
+ - macro: NEWMACRO2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: update one of the user macros with description (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros:
+ - macro: '{$NEWMACRO1}'
+ value: test1234
+ description: Example Description
+ - macro: NEWMACRO2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: update one of the user macros by removing description"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros:
+ - macro: '{$NEWMACRO1}'
+ value: test1234
+ - macro: NEWMACRO2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add user macro while keeping previous ones with force=no"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ force: no
+ macros:
+ - macro: '{$NEWMACRO3}'
+ value: testing
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add the same user macros (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros:
+ - macro: '{$NEWMACRO1}'
+ value: test1234
+ - macro: NEWMACRO2
+ value: abc
+ - macro: '{$NEWMACRO3}'
+ value: testing
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: wipe out all of the user macros"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros: []
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: wipe out all of the user macros (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ macros: []
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: add new set of tags to the host"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tags:
+ - tag: NEWTAG1
+ - tag: NewTag2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add new set of tags to the host (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tags:
+ - tag: NEWTAG1
+ - tag: NewTag2
+ value: abc
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: update one of the tags present on the host"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tags:
+ - tag: NEWTAG1
+ - tag: NewTag2
+ value: abcd
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add tag while keeping previous ones with force=no"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ force: no
+ tags:
+ - tag: newtag3
+ value: testing
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: add the same tags (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tags:
+ - tag: NEWTAG1
+ - tag: NewTag2
+ value: abcd
+ - tag: newtag3
+ value: testing
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: wipe out all of the tags"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tags: []
+ register: zabbix_host1
+
+- name: expect to succeed and that things have changed
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: wipe out all of the tags (again)"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ tags: []
+ register: zabbix_host1
+
+- name: expect to succeed and that things have not changed
+ assert:
+ that:
+ - "zabbix_host1 is not changed"
+
+- name: "test: attempt to delete host created earlier"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ state: absent
+ register: zabbix_host1
+
+- name: deleting a host is a change, right?
+ assert:
+ that:
+ - "zabbix_host1 is changed"
+
+- name: "test: attempt deleting a non-existant host"
+ zabbix_host:
+ server_url: "{{ zabbix_server_url }}"
+ login_user: "{{ zabbix_login_user }}"
+ login_password: "{{ zabbix_login_password }}"
+ host_name: ExampleHost
+ state: absent
+ register: zabbix_host1
+
+- name: deleting a non-existant host is not a change, right?
+ assert:
+ that:
+ - "not zabbix_host1 is changed"