From 16ab5250a159be0ed6c8f38b3ceb050924b84d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rkus=20S=C3=A1ndor?= Date: Sat, 1 Jul 2023 12:50:13 +0200 Subject: [PATCH] first upload --- tasks/configure-zabbix_agent.yml | 6 ++++++ tasks/install-zabbix_agent.yml | 17 +++++++++++++++++ tasks/service-zabbix_agent.yml | 6 ++++++ templates/zabbix_agentd.conf.j2 | 12 ++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 tasks/configure-zabbix_agent.yml create mode 100644 tasks/install-zabbix_agent.yml create mode 100644 tasks/service-zabbix_agent.yml create mode 100644 templates/zabbix_agentd.conf.j2 diff --git a/tasks/configure-zabbix_agent.yml b/tasks/configure-zabbix_agent.yml new file mode 100644 index 0000000..ad80ddb --- /dev/null +++ b/tasks/configure-zabbix_agent.yml @@ -0,0 +1,6 @@ +--- +- name: Zabbix Agent konfigurálása + diff: yes + template: src=~/git/ansible_vagrant/templates/zabbix_agentd.conf.j2 dest={{ ZBXDIR }}/zabbix_agentd.conf backup=yes + notify: + - restart zabbix-agent diff --git a/tasks/install-zabbix_agent.yml b/tasks/install-zabbix_agent.yml new file mode 100644 index 0000000..2a413f2 --- /dev/null +++ b/tasks/install-zabbix_agent.yml @@ -0,0 +1,17 @@ +--- +- name: Zabbix Agent telepítése [Red Hat family] + yum: + name: zabbix-agent + state: latest + update_cache: yes + when: + - ansible_os_family == "RedHat" + +- name: Zabbix Agent telepítése [Debian family] + apt: + name: zabbix-agent + state: latest + update_cache: yes + when: + - ansible_os_family == "Debian" + diff --git a/tasks/service-zabbix_agent.yml b/tasks/service-zabbix_agent.yml new file mode 100644 index 0000000..fff3917 --- /dev/null +++ b/tasks/service-zabbix_agent.yml @@ -0,0 +1,6 @@ +--- +- name: Zabbix Agent engedélyezése és elindítása + service: + name: zabbix-agent + enabled: yes + state: started diff --git a/templates/zabbix_agentd.conf.j2 b/templates/zabbix_agentd.conf.j2 new file mode 100644 index 0000000..917c910 --- /dev/null +++ b/templates/zabbix_agentd.conf.j2 @@ -0,0 +1,12 @@ +################################################################################ +{{ ansible_managed | comment }} +################################################################################ + +PidFile=/run/zabbix/zabbix_agentd.pid +LogFile=/var/log/{{ ZBXLOGDIR }}/zabbix_agentd.log +LogFileSize={{ ZBXLOGFILESIZE }} +Server={{ ZBXSERVER }} +ListenPort={{ ZBXAGENTPORT }} +ListenIP={{ ZBXLISTENIP }} +ServerActive=127.0.0.1 +Hostname={{ inventory_hostname_short}}