|
|
|
---
|
|
|
|
# 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: ""
|
zabbix_host: interface.port parameter is a string (#64986)
interface.port should be a string to be able to use macros in that
value.
This fixes the case when interface.port is a macro (eg.: "{$MACRO}" and
force=false.
Because, until now, setting the interface.port to an integer was the correct way to work with force=false, a type validation has been added
to that parameter.
Previously, if a string was used for interface.port, it was converted
to an integer, the comparison didn't work (if interface not in interfaces)
and the module tried to register the same interface twice, returning an
error.
Zabbix API manual specifies that only 'main, 'type', 'useip' and 'bulk'
are integers.
https://www.zabbix.com/documentation/current/manual/api/reference/hostinterface/object
Tests are changed to use always str in the interface.port.
Two new tests are added.
The first one is to show that now registering a host with force=false and
a macro in interface.port works.
The other one tests that interfaces defined using string for port are
compared correctly when force=false is used. Previously it was
a comparison between int and str, interfaces were seen as different
and an error was thrown because we were trying to create twice a main
interface.
* Try to kindly convert interface port to the string
As suggested, the previous behaviour could break current configurations. This solution accepts integers and strings.
Co-Authored-By: Dusan Matejka <D3DeFi@users.noreply.github.com>
5 years ago
|
|
|
port: "10050"
|
|
|
|
- type: 4
|
|
|
|
main: 1
|
|
|
|
useip: 1
|
|
|
|
ip: 10.1.1.1
|
|
|
|
dns: ""
|
zabbix_host: interface.port parameter is a string (#64986)
interface.port should be a string to be able to use macros in that
value.
This fixes the case when interface.port is a macro (eg.: "{$MACRO}" and
force=false.
Because, until now, setting the interface.port to an integer was the correct way to work with force=false, a type validation has been added
to that parameter.
Previously, if a string was used for interface.port, it was converted
to an integer, the comparison didn't work (if interface not in interfaces)
and the module tried to register the same interface twice, returning an
error.
Zabbix API manual specifies that only 'main, 'type', 'useip' and 'bulk'
are integers.
https://www.zabbix.com/documentation/current/manual/api/reference/hostinterface/object
Tests are changed to use always str in the interface.port.
Two new tests are added.
The first one is to show that now registering a host with force=false and
a macro in interface.port works.
The other one tests that interfaces defined using string for port are
compared correctly when force=false is used. Previously it was
a comparison between int and str, interfaces were seen as different
and an error was thrown because we were trying to create twice a main
interface.
* Try to kindly convert interface port to the string
As suggested, the previous behaviour could break current configurations. This solution accepts integers and strings.
Co-Authored-By: Dusan Matejka <D3DeFi@users.noreply.github.com>
5 years ago
|
|
|
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: ""
|
zabbix_host: interface.port parameter is a string (#64986)
interface.port should be a string to be able to use macros in that
value.
This fixes the case when interface.port is a macro (eg.: "{$MACRO}" and
force=false.
Because, until now, setting the interface.port to an integer was the correct way to work with force=false, a type validation has been added
to that parameter.
Previously, if a string was used for interface.port, it was converted
to an integer, the comparison didn't work (if interface not in interfaces)
and the module tried to register the same interface twice, returning an
error.
Zabbix API manual specifies that only 'main, 'type', 'useip' and 'bulk'
are integers.
https://www.zabbix.com/documentation/current/manual/api/reference/hostinterface/object
Tests are changed to use always str in the interface.port.
Two new tests are added.
The first one is to show that now registering a host with force=false and
a macro in interface.port works.
The other one tests that interfaces defined using string for port are
compared correctly when force=false is used. Previously it was
a comparison between int and str, interfaces were seen as different
and an error was thrown because we were trying to create twice a main
interface.
* Try to kindly convert interface port to the string
As suggested, the previous behaviour could break current configurations. This solution accepts integers and strings.
Co-Authored-By: Dusan Matejka <D3DeFi@users.noreply.github.com>
5 years ago
|
|
|
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"
|