Yo que se ya...

This commit is contained in:
IvanMarts 2025-03-11 09:53:39 +01:00
parent ff4f33744e
commit 5054d44e37

View File

@ -1,7 +1,26 @@
---
- name: Instalar y configurar Zabbix Agent2 usando la colección Zabbix for Ansible
hosts: all
become: no
become: yes
collections:
- community.zabbix
roles:
- role: community.zabbix.zabbix_agent
vars:
# Especificar que se instalará Zabbix Agent2
zabbix_agent_variant: 2
zabbix_agent_config:
Server: "192.168.1.10" # IP/host del servidor Zabbix
ServerActive: "192.168.1.10" # Servidor activo
Hostname: "{{ ansible_hostname }}" # Nombre único en Zabbix
AllowRoot: 1 # Permitir ejecución como root
# Ejecutar servicio como root
zabbix_agent_user: root
zabbix_agent_group: root
tasks:
- name: Copiar configuración personalizada
ansible.builtin.copy:
@ -10,18 +29,4 @@
owner: root
group: root
mode: 0644
roles:
- role: community.zabbix.zabbix_agent
# Versión del agente a instalar
zabbix_agent2: true
zabbix_agent_config:
Server: "192.168.1.10" # Obligatorio: IP/host del servidor Zabbix
ServerActive: "192.168.1.10" # Obligatorio para checks activos
Hostname: "{{ ansible_hostname }}" # Obligatorio: Nombre único en Zabbix
User: root # Usuario para ejecutar comandos
AllowRoot: 1
# Ejecutar servicio como root
zabbix_agent_user: root
zabbix_agent_group: root