ansible/playbooks/00_install_zabbix_agent2.yml
ladislav.dusa afc7817a81 conf added
2024-12-11 16:33:42 +01:00

35 lines
1.2 KiB
YAML
Executable File

- hosts: datacenter
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}}"