Open
Description
So I have my role like this:
- role: zabbix.zabbix.host
### Zabbix API properties
host_zabbix_api_server: zabbix.DOMAIN
host_zabbix_api_port: 443
host_zabbix_api_use_ssl: True
host_templates: ["Linux by SNMP"]
host_interfaces:
- type: snmp
ip: '{{ ansible_host if ansible_host | ansible.utils.ipaddr else omit }}'
dns: '{{ ansible_host if not ansible_host | ansible.utils.ipaddr else omit }}'
useip: '{{ true if ansible_host | ansible.utils.ipaddr else false }}'
port: '161'
details:
version: 3
bulk: true
contextname: ""
max_repetitions: 10
securityname: "{$SNMPV3_SECURITYNAME}"
securitylevel: authPriv
authprotocol: sha1
authpassphrase: "{$SNMPV3_AUTHPASS}"
privprotocol: aes128
privpassphrase: "{$SNMPV3_PRIVATEPASS}"
when: inventory_hostname in groups.get('tags_zabbix_monitoring', [])
Yet it results in an error because the Host was already discovered by VMware discovery and I Just wanted to add SNMP too.
Failure is:
Connection error: REST API returned '{'code': -32500, 'message': 'Application
error.', 'data': 'Cannot update "groups" for a discovered host
"HOSTNAME".'}' when sending '{'jsonrpc': '2.0', 'method': 'host.update',
'id': 'ID', 'params': {'description':
'Managed by Ansible. Added with "zabbix_host" module.', 'groups': [{'groupid':
'322'}, {'groupid': '320'}, {'groupid': '319'}, {'groupid': '318'},
{'groupid': '316'}, {'groupid': '324'}, {'groupid': '323'}, {'groupid':
'317'}, {'groupid': '321'}, {'groupid': '325'}, {'groupid': '326'}],
'templates': [{'templateid': '10248'}], 'templates_clear': [{'templateid':
'10174'}], 'tags': [{'tag': 'managed', 'value': ''}], 'interfaces': [{'type':
'2', 'main': '1', 'useip': '1', 'ip': '10.52.224.2', 'dns': '', 'port': '161',
'details': {'version': '3', 'bulk': '1', 'max_repetitions': '10',
'contextname': '', 'securityname': '{$SNMPV3_SECURITYNAME}', 'securitylevel':
'2', 'authprotocol': '1', 'authpassphrase': '********', 'privprotocol': '1',
'privpassphrase': '********'}}], 'hostid': '11440'}}'
Since its trying to add the ansible hostgroups as groups in zabbix.
Metadata
Metadata
Assignees
Labels
No labels