ajout du role zabbix-srv
This commit is contained in:
parent
bce5723e7b
commit
92c6b3eb89
18
roles/zabbix-srv/README.md
Normal file
18
roles/zabbix-srv/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# 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 ?
|
||||
|
||||
|
||||
### Installation et configuration de Zabbix
|
||||
|
||||
Le rôle Zabbix va installer apache2 pour le serveur web, zabbix-server pour la supervision, zabbix qui sera notre outil de supervision.
|
||||
|
||||
Lors de la première connexion, on indique les identifiants de la BDD avec "zabbix" et "password".
|
||||
|
||||
Pour l'id de Zabbix, c'est "Admin" et "zabbix", à l'adresse "https://s-mon/zabbix".
|
17
roles/zabbix-srv/handlers/main.yml
Normal file
17
roles/zabbix-srv/handlers/main.yml
Normal file
@ -0,0 +1,17 @@
|
||||
- name: restart zabbix server
|
||||
service:
|
||||
name: zabbix-server
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
||||
- name: restart apache2
|
||||
service:
|
||||
name: apache2
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
||||
- name: restart zabbix agent
|
||||
service:
|
||||
name: zabbix-agent
|
||||
state: restarted
|
||||
enabled: yes
|
78
roles/zabbix-srv/tasks/main.yml
Normal file
78
roles/zabbix-srv/tasks/main.yml
Normal file
@ -0,0 +1,78 @@
|
||||
- name: 1. Récupérer les dépots de zabbix
|
||||
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
|
||||
|
||||
- name: 2. Installer les depots
|
||||
apt:
|
||||
deb: "/tmp/zabbix-release_6.4-1+debian12_all.deb"
|
||||
state: present
|
||||
|
||||
- name: 3. Lancer un apt update
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: 4. Installer les paquets de zabbix et mariadb
|
||||
apt:
|
||||
name:
|
||||
- zabbix-server-mysql
|
||||
- zabbix-frontend-php
|
||||
- zabbix-apache-conf
|
||||
- zabbix-sql-scripts
|
||||
- zabbix-agent
|
||||
- mariadb-server
|
||||
- python3-pymysql
|
||||
state: present
|
||||
|
||||
- name: 5. s'assurer que mariadb est en fonctionnement
|
||||
service:
|
||||
name: mariadb
|
||||
state: started
|
||||
|
||||
- name: 6. Créer la base de données
|
||||
community.mysql.mysql_db:
|
||||
name: zabbix
|
||||
encoding: utf8mb4
|
||||
collation: utf8mb4_bin
|
||||
state: present
|
||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||
|
||||
- name: 7. Creer un utilisateur et lui attribuer tous les droits
|
||||
community.mysql.mysql_user:
|
||||
name: zabbix
|
||||
password: password
|
||||
priv: '*.*:ALL,GRANT'
|
||||
state: present
|
||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||
|
||||
- name: 8. Modifier une variable pour importer un schema
|
||||
community.mysql.mysql_variables:
|
||||
variable: log_bin_trust_function_creators
|
||||
value: 1
|
||||
mode: global
|
||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||
|
||||
- name: 9. Importer le schema initial
|
||||
shell: zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -ppassword zabbix
|
||||
|
||||
- name: 10. Modifier la variable pour le schema
|
||||
community.mysql.mysql_variables:
|
||||
variable: log_bin_trust_function_creators
|
||||
value: 0
|
||||
mode: global
|
||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||
|
||||
- name: 11. Configurer le mdp de la db
|
||||
replace:
|
||||
path: /etc/zabbix/zabbix_server.conf
|
||||
regexp: '^# DBPassword='
|
||||
replace: 'DBPassword=password'
|
||||
|
||||
- name: 12. Lancer le service zabbix
|
||||
service:
|
||||
name:
|
||||
- zabbix-server
|
||||
- zabbix-agent
|
||||
- apache2
|
||||
state: restarted
|
||||
enabled: yes
|
Loading…
x
Reference in New Issue
Block a user