Loading README.md +29 −14 Original line number Diff line number Diff line # Overview This role the installation and configuration of the Zabbix Agent version 2. # Supported Operating Systems ## Supported Operating Systems | Operating System | Version | | --- | ----- | | Debian | 12 | Loading @@ -9,20 +11,27 @@ This role the installation and configuration of the Zabbix Agent version 2. | Ubuntu | 22.04 LTS | | Ubuntu | 24.04 LTS | # Variables ## Variables | Variable | Type | Default | Required | | --- | --- | --- | --- | | zabbix_proxy_address | string | | Yes | | zabbix_agent_hostinterface | string | inventory_hostname | No | | zabbix_agent_hostname | string | inventory_hostname | No | | zabbix_agent_listen_port | string | 10050 | No | | zabbix_agent_psk_enable | bool | true | No | | zabbix_agent_psk_id | string | | Yes | | zabbix_agent_psk | string(enc) | | Yes | | zabbix_agent_psk_id | string | | Yes* | | zabbix_agent_psk | string(enc) | | Yes* | | zabbix_proxy_address | string | shared.proxy.monitor.itcreation.tools | No | | zabbix_proxy_port | string | 10051 | No | | zabbix_user_sudo | bool | true | No | # Example usage * Only if `zabbix_agent_psk_enable` is set to `true`. ## Example usage With PSK: ``` ```yaml zabbix_proxy_address: "proxy.monitor.localnet.internal" zabbix_agent_psk_id: "client-psk" zabbix_agent_psk: !vault Loading @@ -30,27 +39,33 @@ zabbix_agent_psk: !vault 31633463613336373164373333633038393164383835646633303163316665303934646363383530 ... ``` Without PSK: ``` ```yaml zabbix_proxy_address: "proxy.monitor.localnet.internal" ``` ## DNS override ### DNS override If DNS is complicated or permanently broken for some reason. We can override the hostname and hostinterface. The hostname is the visible name in Zabbix. The hostinterface is what Zabbix uses to connect to the host. ``` ```yaml zabbix_agent_hostname: "server.example.com" zabbix_agent_hostinterface: "192.168.10.10" ``` This is possible, but please `only use if really required`. # Tags ## Tags If you call the role without tags, it will execute all of the stages bellow. | Tags | Purpose | | --- | --- | | zabbix_agent | Executes the whole playbook | | zabbix_agent_config | Only manage Zabbix Agent 2 configuration | | zabbix_agent_install | Only manage Zabbix Agent 2 installation | | zabbix_agent_prereq | Only manage Zabbix Agent 2 prerequisites | defaults/main.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,11 @@ zabbix_major_version: "7.2" # zabbix agent defaults zabbix_agent_psk_enable: true zabbix_agent_listen_port: "10050" # zabbix server / proxy connectivity zabbix_proxy_address: "zabbix.siempie.internal" zabbix_proxy_port: "10051" # zabbix user permissions zabbix_user_sudo: true tasks/prerequisites.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ when: 'ansible_os_family == "Suse"' block: - name: "remove old version" - name: "remove old zabbix-release" ansible.builtin.zypper: name: "zabbix-release" state: "absent" Loading templates/zabbix/zabbix_agent.conf.j2 +3 −3 Original line number Diff line number Diff line # general Hostname={{ zabbix_agent_hostname | default(inventory_hostname) }} Server={{ zabbix_proxy_address }} ServerActive={{ zabbix_proxy_address }} ListenPort=10050 Server={{ zabbix_proxy_address }}:{{ zabbix_proxy_port }} ServerActive={{ zabbix_proxy_address }}:{{ zabbix_proxy_port }} ListenPort={{ zabbix_agent_listen_port }} HostMetadataItem=system.uname HostInterface={{ zabbix_agent_hostinterface | default(inventory_hostname) }} AllowKey=system.run[*] Loading Loading
README.md +29 −14 Original line number Diff line number Diff line # Overview This role the installation and configuration of the Zabbix Agent version 2. # Supported Operating Systems ## Supported Operating Systems | Operating System | Version | | --- | ----- | | Debian | 12 | Loading @@ -9,20 +11,27 @@ This role the installation and configuration of the Zabbix Agent version 2. | Ubuntu | 22.04 LTS | | Ubuntu | 24.04 LTS | # Variables ## Variables | Variable | Type | Default | Required | | --- | --- | --- | --- | | zabbix_proxy_address | string | | Yes | | zabbix_agent_hostinterface | string | inventory_hostname | No | | zabbix_agent_hostname | string | inventory_hostname | No | | zabbix_agent_listen_port | string | 10050 | No | | zabbix_agent_psk_enable | bool | true | No | | zabbix_agent_psk_id | string | | Yes | | zabbix_agent_psk | string(enc) | | Yes | | zabbix_agent_psk_id | string | | Yes* | | zabbix_agent_psk | string(enc) | | Yes* | | zabbix_proxy_address | string | shared.proxy.monitor.itcreation.tools | No | | zabbix_proxy_port | string | 10051 | No | | zabbix_user_sudo | bool | true | No | # Example usage * Only if `zabbix_agent_psk_enable` is set to `true`. ## Example usage With PSK: ``` ```yaml zabbix_proxy_address: "proxy.monitor.localnet.internal" zabbix_agent_psk_id: "client-psk" zabbix_agent_psk: !vault Loading @@ -30,27 +39,33 @@ zabbix_agent_psk: !vault 31633463613336373164373333633038393164383835646633303163316665303934646363383530 ... ``` Without PSK: ``` ```yaml zabbix_proxy_address: "proxy.monitor.localnet.internal" ``` ## DNS override ### DNS override If DNS is complicated or permanently broken for some reason. We can override the hostname and hostinterface. The hostname is the visible name in Zabbix. The hostinterface is what Zabbix uses to connect to the host. ``` ```yaml zabbix_agent_hostname: "server.example.com" zabbix_agent_hostinterface: "192.168.10.10" ``` This is possible, but please `only use if really required`. # Tags ## Tags If you call the role without tags, it will execute all of the stages bellow. | Tags | Purpose | | --- | --- | | zabbix_agent | Executes the whole playbook | | zabbix_agent_config | Only manage Zabbix Agent 2 configuration | | zabbix_agent_install | Only manage Zabbix Agent 2 installation | | zabbix_agent_prereq | Only manage Zabbix Agent 2 prerequisites |
defaults/main.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,11 @@ zabbix_major_version: "7.2" # zabbix agent defaults zabbix_agent_psk_enable: true zabbix_agent_listen_port: "10050" # zabbix server / proxy connectivity zabbix_proxy_address: "zabbix.siempie.internal" zabbix_proxy_port: "10051" # zabbix user permissions zabbix_user_sudo: true
tasks/prerequisites.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ when: 'ansible_os_family == "Suse"' block: - name: "remove old version" - name: "remove old zabbix-release" ansible.builtin.zypper: name: "zabbix-release" state: "absent" Loading
templates/zabbix/zabbix_agent.conf.j2 +3 −3 Original line number Diff line number Diff line # general Hostname={{ zabbix_agent_hostname | default(inventory_hostname) }} Server={{ zabbix_proxy_address }} ServerActive={{ zabbix_proxy_address }} ListenPort=10050 Server={{ zabbix_proxy_address }}:{{ zabbix_proxy_port }} ServerActive={{ zabbix_proxy_address }}:{{ zabbix_proxy_port }} ListenPort={{ zabbix_agent_listen_port }} HostMetadataItem=system.uname HostInterface={{ zabbix_agent_hostinterface | default(inventory_hostname) }} AllowKey=system.run[*] Loading