This guide installs a Zabbix 8.0 server on Rocky Linux 10 and adds a Rocky Linux
10 client with passive PSK monitoring.
Two roles are used:
| Purpose | Role |
|---|---|
| Zabbix server, PostgreSQL 16, frontend and local Agent 2 | tuxbull.zabbix_server |
| Agent 2 installation and secure host onboarding | tuxbull.zabbix_agent |
sudo access to both Rocky Linux 10 hostsfirewalld already active on the clientThe Agent role requires the standard Zabbix objects Linux servers and
Linux by Zabbix agent. A server created by tuxbull.zabbix_server provides
them.
Create requirements.yml:
---
roles:
- name: tuxbull.zabbix_server
src: https://github.com/Tuxbull-Open-Source/ansible.zabbix_server.git
scm: git
version: e1b7eae566719e6827e6faa13d038f95ec7f3d0a
- name: tuxbull.zabbix_agent
src: https://github.com/Tuxbull-Open-Source/ansible.zabbix_agent.git
scm: git
version: aa177f5fe24020a180814f6165b15b3e089b123e
collections:
- name: community.zabbix
version: 4.3.0
- name: fedora.linux_system_roles
version: 2.5.0
- name: ansible.utils
version: 6.0.1
- name: ansible.posix
version: 2.1.0
- name: community.general
version: 12.4.0
- name: community.postgresql
version: 4.2.0
Install the dependencies:
ansible-galaxy role install -r requirements.yml --force
ansible-galaxy collection install -r requirements.yml
The repositories contain a larger exact transitive collection lock. Prefer their
complete requirements.yml files when building a long-lived control repository.
Create inventory.yml:
---
all:
children:
zabbix_servers:
hosts:
zabbix-01.example.test:
ansible_host: 192.0.2.10
ansible_user: ansible
zabbix_agents:
hosts:
app-01.example.test:
ansible_host: 192.0.2.20
ansible_user: ansible
zabbix_onboarding_api_delegate: zabbix-01.example.test
zabbix_onboarding_server_ip: 192.0.2.10
zabbix_onboarding_management_ip: 192.0.2.20
zabbix_onboarding_host_name: app-01.example.test
zabbix_onboarding_visible_name: Application Server 01
zabbix_onboarding_psk_identity: zabbix-agent2-app-01
zabbix_onboarding_psk_version: "1"
zabbix_onboarding_api_delegate is the inventory name of the Zabbix server.
Ansible delegates API calls there and uses the server-local Zabbix API. The
Ansible controller does not need direct access to the frontend.
Create vault.yml:
---
vault_zabbix_database_password: CHANGE_ME
vault_zabbix_admin_password: CHANGE_ME
vault_zabbix_agent_psks:
app-01.example.test: CHANGE_ME
Replace every placeholder before encryption:
_ and -;Generate a PSK, edit the file, and encrypt it:
openssl rand -hex 32
$EDITOR vault.yml
ansible-vault encrypt vault.yml
Keep the Vault password outside Git.
Create server.yml:
---
- name: Install the Zabbix server
hosts: zabbix_servers
gather_facts: true
become: true
vars_files:
- vault.yml
vars:
zabbix_integration_database_password: "{{ vault_zabbix_database_password }}"
zabbix_integration_admin_password: "{{ vault_zabbix_admin_password }}"
# Resolve these exact suffixes from the target's Zabbix repository.
zabbix_integration_server_release: 0-release1.el10
zabbix_integration_web_release: 0-release1.el10
zabbix_integration_agent_release: 0-release1.el10
zabbix_integration_timezone: UTC
zabbix_integration_admin_bootstrap: true
zabbix_integration_publish: false
roles:
- role: tuxbull.zabbix_server
Run the playbook twice:
ansible-playbook -i inventory.yml server.yml --ask-vault-pass --syntax-check
ansible-playbook -i inventory.yml server.yml --ask-vault-pass
ansible-playbook -i inventory.yml server.yml --ask-vault-pass
The second full run must report changed=0.
By default, PostgreSQL, the Zabbix server, the local Agent 2 and the web frontend
listen only on loopback. The role does not open a firewall or configure external
DNS. Review the server role's HTTPS documentation before enabling its optional
direct self-signed endpoint.
Create agents.yml:
---
- name: Install and register Zabbix Agent 2
hosts: zabbix_agents
gather_facts: true
become: true
vars_files:
- vault.yml
vars:
zabbix_onboarding_api_password: "{{ vault_zabbix_admin_password }}"
zabbix_onboarding_psk: "{{ vault_zabbix_agent_psks[inventory_hostname] }}"
roles:
- role: tuxbull.zabbix_agent
Run only the new client first, then rerun it:
ansible-playbook -i inventory.yml agents.yml --ask-vault-pass \
--limit app-01.example.test
ansible-playbook -i inventory.yml agents.yml --ask-vault-pass \
--limit app-01.example.test
The second run must report changed=0.
The Agent role:
Check the Agent service, listener and firewall:
ansible -i inventory.yml zabbix_agents -b \
-m ansible.builtin.command -a 'systemctl is-active zabbix-agent2'
ansible -i inventory.yml zabbix_agents -b \
-m ansible.builtin.command -a 'ss -H -lntp sport = :10050'
ansible -i inventory.yml zabbix_agents -b \
-m ansible.builtin.command -a 'firewall-cmd --list-rich-rules'
Expected state:
zabbix_agent2;/32 rule allowing only the Zabbix server;agent.ping returns 1 and receives fresh history;changed=0.zabbix_agents.vault_zabbix_agent_psks using the new inventory name aszabbix_onboarding_psk_version at "1".--limit for that host.To rotate a PSK, change the encrypted PSK and increment
zabbix_onboarding_psk_version in the same reviewed change. Never change the PSK
or its identity without increasing the version.
ServerActive is disabled.