Files
Terraform/roles/lib/setup-zabbix-agent.yml
2024-12-18 00:31:03 -06:00

33 lines
858 B
YAML

- name: Download Zabbix Repo
ansible.builtin.get_url:
url: "https://repo.zabbix.com/zabbix/7.2/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.2+debian12_all.deb"
dest: "/tmp/zabbix-release_7.2.deb"
- name: Install Zabbix Repo package
ansible.builtin.apt:
deb: /tmp/zabbix-release_7.2.deb
- name: Install zabbix-agent2 and plugins
ansible.builtin.apt:
name:
- zabbix-agent2
- zabbix-agent2-plugin-*
update_cache: yes
- name: Restart zabbix-agent2
systemd:
name: zabbix-agent2
state: restarted
- name: Enable zabbix-agent2 to start on boot
systemd:
name: zabbix-agent2
enabled: yes
- name: Update zabbix-agent2.conf
ansible.builtin.lineinfile:
path: /etc/zabbix/zabbix_agent2.conf
regexp: '^Server=.*'
line: 'Server=192.168.0.59'
state: present
backup: yes