Skip to content

Commit

Permalink
Added monitored_by and proxy_group settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrodie18 committed Sep 8, 2024
1 parent 710260b commit 5117ab2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/monitored_by.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- zabbix_agent Role - Added ability to set the monitored_by and proxy_group values.
2 changes: 2 additions & 0 deletions docs/ZABBIX_AGENT_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ Host encryption configuration will be set to match agent configuration.
* `zabbix_agent_ip`: The IP address of the host. When not provided, it will be determined via the `ansible_default_ipv4` fact.
* `zabbix_agent_link_templates`: A list of templates which needs to be link to this host. The templates should exist. Default: "Templated Linux by Zabbix agent"
* `zabbix_agent_macros`: A list with macro_key and macro_value for creating hostmacro's.
* `zabbix_agent_monitoredby`: How the agent is monitored. Choices are 'zabbix_server', 'proxy', and 'proxy_group'. (Zabbix 7.0 or greater)
* `zabbix_agent_proxy`: The name of the Zabbix proxy (if used). Default `null`
* `zabbix_agent_proxygroup`: The name of the Zabbix proxy group (if used) (Zabbix 7.0 or later).
* `zabbix_agent_tags`: A list with tag and (optionally) value for creating host tags.
* `zabbix_api_create_hostgroup`: When you want to enable the Zabbix API to create/delete the hostgroups. Default: `False`
* `zabbix_api_create_hosts`: Default: `False`. When you want to enable the Zabbix API to create/delete the host. This has to be set to `True` if you want to make use of `zabbix_agent_host_state`.
Expand Down
28 changes: 15 additions & 13 deletions roles/zabbix_agent/tasks/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@
- name: "API | Create a new host or update an existing host's info"
community.zabbix.zabbix_host:
host_name: "{{ zabbix_agent_hostname }}"
host_groups: "{{ zabbix_host_groups }}"
link_templates: "{{ zabbix_agent_link_templates }}"
status: "{{ zabbix_host_status }}"
state: "{{ zabbix_agent_host_state }}"
description: "{{ zabbix_agent_description | default(omit) }}"
force: "{{ zabbix_agent_host_update }}"
proxy: "{{ zabbix_agent_proxy }}"
inventory_mode: "{{ zabbix_agent_inventory_mode }}"
host_groups: "{{ zabbix_host_groups }}"
interfaces: "{{ zabbix_agent_interfaces }}"
visible_name: "{{ zabbix_agent_visible_hostname | default(zabbix_agent_hostname) }}"
tls_psk: "{{ zabbix_agent_tlspsk_secret | default(omit) }}"
tls_psk_identity: "{{ zabbix_agent_tlspskidentity | default(omit) }}"
tls_issuer: "{{ zabbix_agent_tlsservercertissuer | default(omit) }}"
tls_subject: "{{ zabbix_agent_tls_subject | default(omit) }}"
tls_accept: "{{ zabbix_agent_tls_config[zabbix_agent_tlsaccept | default('unencrypted')] }}"
tls_connect: "{{ zabbix_agent_tls_config[zabbix_agent_tlsconnect | default('unencrypted')] }}"
description: "{{ zabbix_agent_description | default(omit) }}"
inventory_mode: "{{ zabbix_agent_inventory_mode }}"
inventory_zabbix: "{{ zabbix_agent_inventory_zabbix | default({}) }}"
ipmi_authtype: "{{ zabbix_agent_ipmi_authtype | default(omit) }}"
ipmi_password: "{{ zabbix_agent_ipmi_password| default(omit) }}"
ipmi_privilege: "{{ zabbix_agent_ipmi_privilege | default(omit) }}"
ipmi_username: "{{ zabbix_agent_ipmi_username | default(omit) }}"
link_templates: "{{ zabbix_agent_link_templates }}"
monitored_by: "{{ zabbix_agent_monitoredby | default(omit) }}"
proxy: "{{ zabbix_agent_proxy }}"
proxy_group: "{{ zabbix_agent_proxygroup | default(omit) }}"
state: "{{ zabbix_agent_host_state }}"
tls_accept: "{{ zabbix_agent_tls_config[zabbix_agent_tlsaccept | default('unencrypted')] }}"
tls_connect: "{{ zabbix_agent_tls_config[zabbix_agent_tlsconnect | default('unencrypted')] }}"
tls_issuer: "{{ zabbix_agent_tlsservercertissuer | default(omit) }}"
tls_psk: "{{ zabbix_agent_tlspsk_secret | default(omit) }}"
tls_psk_identity: "{{ zabbix_agent_tlspskidentity | default(omit) }}"
tls_subject: "{{ zabbix_agent_tls_subject | default(omit) }}"
tags: "{{ zabbix_agent_tags | default(omit) }}"
visible_name: "{{ zabbix_agent_visible_hostname | default(zabbix_agent_hostname) }}"
register: zabbix_api_host_created
until: zabbix_api_host_created is succeeded
retries: 10
Expand Down

0 comments on commit 5117ab2

Please sign in to comment.