From fb900be1e44a97b9f365caf97de54b9878569ad2 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 22 Dec 2023 15:00:33 +0100 Subject: [PATCH] Ajout role Zabbix-cli + ajout des agents dans les srv --- roles/zabbix-cli/README.md | 14 +++++++++ roles/zabbix-cli/handlers/main.yml | 12 ++++++++ roles/zabbix-cli/tasks/main.yml | 29 +++++++++++++++++++ .../templates/zabbix_agentd.conf.temp | 7 +++++ s-adm.yml | 2 +- s-appli.yml | 2 +- s-backup.yml | 2 +- s-infra.yml | 2 +- s-itil.yml | 2 +- s-proxy.yml | 2 +- 10 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 roles/zabbix-cli/README.md create mode 100644 roles/zabbix-cli/handlers/main.yml create mode 100644 roles/zabbix-cli/tasks/main.yml create mode 100644 roles/zabbix-cli/templates/zabbix_agentd.conf.temp diff --git a/roles/zabbix-cli/README.md b/roles/zabbix-cli/README.md new file mode 100644 index 0000000..8de8e8f --- /dev/null +++ b/roles/zabbix-cli/README.md @@ -0,0 +1,14 @@ +# Rôle nagios +*** +Rôle Nagios pour la supervision des différentes machines + +## Tables des matières + 1. [Que fait le rôle Zabbix ?] + + +## Que fait le rôle Nagios ? +Il permet de configurer les agents zabbix en active. + +### Installation et configuration de Zabbix-agent + +Le rôle Zabbix-cli va installer zabbix-agent pour les serveurs, zabbix-agent pour superviser, zabbix-agent sera notre outil de supervision côté serveurs. diff --git a/roles/zabbix-cli/handlers/main.yml b/roles/zabbix-cli/handlers/main.yml new file mode 100644 index 0000000..abc4eb7 --- /dev/null +++ b/roles/zabbix-cli/handlers/main.yml @@ -0,0 +1,12 @@ + - name: config + template: + src: zabbix_agentd.conf.temp + dest: /etc/zabbix/zabbix_agentd.conf + vars: + PidFile: /run/zabbix/zabbix_agentd.pid + LogFile: /var/log/zabbix/zabbix_agentd.log + LogFileSize: 0 + Server: 127.0.0.1 + ServerActive: 192.168.99.106 + Hostname: "{{ ansible_hostname }}" + Include: /etc/zabbix/zabbix_agentd.d/*.conf diff --git a/roles/zabbix-cli/tasks/main.yml b/roles/zabbix-cli/tasks/main.yml new file mode 100644 index 0000000..6e56521 --- /dev/null +++ b/roles/zabbix-cli/tasks/main.yml @@ -0,0 +1,29 @@ + - name: Intallation paquet zabbix agent + get_url: + url: "https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian12_all.deb" + dest: "/tmp/zabbix-release_6.4-1+debian12_all.deb" + + - name: Intallation paquet zabbix agent suite + apt: + deb: "/tmp/zabbix-release_6.4-1+debian12_all.deb" + state: present + + - name: Update apt + apt: + update_cache: yes + + - name: Intallation Zabbix agent + apt: + name: zabbix-agent + state: present + + - name: Enable Zabbix agent service + systemd: + name: zabbix-agent + enabled: yes + + - name: Rm package + file: + path: "/tmp/zabbix-release_6.4-1+debian12_all.deb" + state: absent + diff --git a/roles/zabbix-cli/templates/zabbix_agentd.conf.temp b/roles/zabbix-cli/templates/zabbix_agentd.conf.temp new file mode 100644 index 0000000..9191ff5 --- /dev/null +++ b/roles/zabbix-cli/templates/zabbix_agentd.conf.temp @@ -0,0 +1,7 @@ +PidFile={{ PidFile }} +LogFile={{ LogFile }} +LogFileSize={{ LogFileSize }} +Server={{ Server }} +ServerActive={{ ServerActive }} +Hostname={{ Hostname }} +Include={{ Include }} diff --git a/s-adm.yml b/s-adm.yml index bcb84be..af198f1 100644 --- a/s-adm.yml +++ b/s-adm.yml @@ -8,7 +8,7 @@ - dnsmasq - squid # - local-store - - snmp-agent + - zabbix-cli ## - syslog-cli - post # - goss diff --git a/s-appli.yml b/s-appli.yml index 37f322e..774b578 100644 --- a/s-appli.yml +++ b/s-appli.yml @@ -8,7 +8,7 @@ - appli - ssh-cli # - syslog-cli - - snmp-agent + - zabbix-cli - ssl-apache - post diff --git a/s-backup.yml b/s-backup.yml index 885d5a3..e68ec35 100644 --- a/s-backup.yml +++ b/s-backup.yml @@ -6,7 +6,7 @@ - base - goss # - proxy3 - - snmp-agent + - zabbix-cli # - ssh-cli # - syslog-cli - smb-backup diff --git a/s-infra.yml b/s-infra.yml index 28c4448..608a338 100644 --- a/s-infra.yml +++ b/s-infra.yml @@ -7,7 +7,7 @@ - goss - dns-master - webautoconf - - snmp-agent + - zabbix-cli - journald-snd - ssh-cli - post diff --git a/s-itil.yml b/s-itil.yml index b8ece3a..3589210 100644 --- a/s-itil.yml +++ b/s-itil.yml @@ -13,7 +13,7 @@ roles: - base - goss - - snmp-agent + - zabbix-cli - glpi - ssh-cli # - syslog-cli diff --git a/s-proxy.yml b/s-proxy.yml index 4cd47a8..0a1f444 100644 --- a/s-proxy.yml +++ b/s-proxy.yml @@ -6,7 +6,7 @@ - base - goss - squid - - snmp-agent + - zabbix-cli - ssh-cli # - syslog-cli - post