From cdb8a6561a0a785f9b149affc163effd297037d1 Mon Sep 17 00:00:00 2001 From: David Lopez Date: Tue, 22 Aug 2023 09:19:33 +0000 Subject: [PATCH] Update zabbix-agent/main.yaml --- zabbix-agent/main.yaml | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/zabbix-agent/main.yaml b/zabbix-agent/main.yaml index e69de29..635ff6d 100644 --- a/zabbix-agent/main.yaml +++ b/zabbix-agent/main.yaml @@ -0,0 +1,50 @@ +--- +- hosts: all + gather_facts: yes + tasks: + - name: gather os specific variables + include_vars: "{{ item }}" + with_first_found: + - "vars/{{ ansible_distribution }}.yaml" + + - name: Download zabbix repo package + get_url: + url: "{{ zabbix_repo_url}}" + dest: /tmp/zabbix.deb + + - name: Install zabbix repo + become: yes + apt: + deb: /tmp/zabbix.deb + state: present + + - name: Install zabbix agent + become: yes + apt: + name: zabbix-agent + state: present + update_cache: yes + + - name: Stop service zabbix-agent + become: yes + service: + name: zabbix-agent + state: stopped + + - name: Remove zabbix config file + become: yes + file: + path: /etc/zabbix/zabbix_agentd.conf + state: absent + + - name: Create new zabbix config file from template + become: yes + template: + src: "templates/zabbix_agentd.conf.j2" + dest: "/etc/zabbix/zabbix_agentd.conf" + + - name: Start service zabbix-agent + become: yes + service: + name: zabbix-agent + state: started \ No newline at end of file