2023-10-26 13:18:22 +02:00
|
|
|
- hosts: datacenter
|
2023-10-24 10:19:06 +02:00
|
|
|
name: Install zabbix agent
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- name: Reconfigure zabbix agent Server
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/zabbix/zabbix_agent2.conf
|
|
|
|
regexp: "^Server=.*"
|
|
|
|
insertafter: '^# Server='
|
|
|
|
line: "Server=192.168.77.106"
|
|
|
|
|
|
|
|
- name: Reconfigure zabbix agent ServerActive
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/zabbix/zabbix_agent2.conf
|
|
|
|
regexp: "^ServerActive=.*"
|
|
|
|
insertafter: '^# ServerActive='
|
|
|
|
line: "ServerActive=192.168.77.106"
|
|
|
|
- name: Reconfigure zabbix agent ListenPort
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/zabbix/zabbix_agent2.conf
|
|
|
|
regexp: "^ListenPort=.*"
|
|
|
|
insertafter: '^# ListenPort='
|
|
|
|
line: "ListenPort=10050"
|
|
|
|
- name: Reconfigure zabbix agent ListenIP
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/zabbix/zabbix_agent2.conf
|
|
|
|
regexp: "^ListenIP=.*"
|
|
|
|
insertafter: '^# ListenIP='
|
|
|
|
line: "ListenIP=0.0.0.0"
|
|
|
|
- name: Reconfigure zabbix-agent2 hostname
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/zabbix/zabbix_agent2.conf
|
|
|
|
regexp: "^Hostname=.*"
|
|
|
|
insertafter: '^# Hostname='
|
|
|
|
line: "Hostname={{ansible_hostname}}"
|