creation du playbook apdbdump.yml

This commit is contained in:
uap33-2025-r 2024-11-14 08:36:45 +00:00
parent 47472f2d25
commit 8a44865367
4 changed files with 82 additions and 0 deletions

28
ansible/apbase.yml Normal file
View File

@ -0,0 +1,28 @@
---
- hosts: all
become: yes
tasks:
- name: changement de la timezone
timezone:
name: Europe/Paris
- name: configure le fichier apt.conf pour le proxy
copy:
content: |
Acquire::http::Proxy "http://10.121.38.1:8080";
Acquire::https::Proxy "http://10.121.38.1:8080";
dest: /etc/apt/apt.conf
- name: installation des paquets de tomcat10, ant et mariadb-server
apt:
name:
- tomcat10
- ant
- mariadb-server
state: present
- name: installation de qemu-guest-agent
apt:
name: qemu-guest-agent
state: present

34
ansible/apdb.yml Normal file
View File

@ -0,0 +1,34 @@
---
- hosts: all
become: yes
tasks:
- name: installation de python3
apt:
name: python3-pymysql
- name: creation de la base de donnees "sdis29"
community.mysql.mysql_db:
name: sdis29
state: present
login_unix_socket: /run/mysqld/mysqld.sock
- name: Creation d'un utilisateur avec tous les privileges
community.mysql.mysql_user:
name: admin
password: password123*
priv: '*.*:ALL'
state: present
login_unix_socket: /run/mysqld/mysqld.sock
- name: copie du dump mysql sur la machine pt
copy:
src: sdis29.sql
dest: /tmp
- name: Import du fichier sdis29.sql sur la base de données sdis29
community.mysql.mysql_db:
name: sdis29
state: import
target: /tmp/sdis29.sql
force: true
login_unix_socket: /run/mysqld/mysqld.sock

18
ansible/apdbdump.yml Normal file
View File

@ -0,0 +1,18 @@
---
- hosts: all
become: yes
tasks:
- name: export de la database sdis29
community.mysql.mysql_db:
state: dump
name: sdis29
target: /tmp/sdis29-dump.sql
login_unix_socket: /run/mysqld/mysqld.sock
- name: recuperation du fichier de dump sur la machine locale
fetch:
src: /tmp/sdis29-dump.sql
dest: sdis29-dump.sql
flat: yes

2
ansible/hosts Normal file
View File

@ -0,0 +1,2 @@
[pt]
ap33-pt