mise à jour
This commit is contained in:
parent
9a9122c181
commit
e8cf17309b
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: apbase
|
- name: apdb
|
||||||
hosts: web
|
hosts: web
|
||||||
become: yes
|
become: yes
|
||||||
tasks:
|
tasks:
|
||||||
@ -8,37 +8,56 @@
|
|||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- python3-PyMySQL
|
- python3-pymysql
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: 2. s'assurer que mariadb est en fonctionnement
|
- name: 2. s'assurer que mariadb est en fonctionnement
|
||||||
service:
|
service:
|
||||||
name: mariadb-server
|
name: mariadb
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: 3. Creer un utilisateur 'admin' lui attribuer tous les droits
|
- name: 3. Creer un utilisateur et lui attribuer tous les droits
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: admin
|
name: slamers
|
||||||
password: admin
|
password: slamers
|
||||||
priv: '*.*:ALL'
|
priv: '*.*:ALL,GRANT'
|
||||||
state: present
|
state: present
|
||||||
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
- name: 4. Creation de la base de donnee 'sdis2023'
|
- name: 4. Creation de la base de donnee 'sdis2023'
|
||||||
community.mysql_db.mysql_db:
|
|
||||||
name: sdis2023
|
|
||||||
state: present
|
|
||||||
|
|
||||||
# Copier le fichier de sauvegarde de la base de données sur l'hôte distant et le restaurer dans la base de données 'sdis2023'
|
|
||||||
- name: 5. Copie de la sauvegarde de la base de données sur l'hôte distant
|
|
||||||
copy:
|
|
||||||
src: sdis2023.sql
|
|
||||||
dest: /tmp/
|
|
||||||
|
|
||||||
- name: 6. Restaurer la base de données
|
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
name: sdis2023
|
name: sdis2023
|
||||||
state: import
|
state: present
|
||||||
target: /tmp/sdis2023
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
|
# - name: Cration de la base de donnée
|
||||||
|
# mysql_db:
|
||||||
|
#name: "{{ sdis2023 }}"
|
||||||
|
# login_host: "{{ root }}"
|
||||||
|
# login_user: "{{ root }}"
|
||||||
|
#login_password: "{{ root }}"
|
||||||
|
#state: present
|
||||||
|
|
||||||
|
#- name: 3. Creer un utilisateur 'admin' lui attribuer tous les droits
|
||||||
|
#community.mysql.mysql_user:
|
||||||
|
#name: admin
|
||||||
|
#password: admin
|
||||||
|
#priv: '*.*:ALL,GRANT'
|
||||||
|
#state: present
|
||||||
|
|
||||||
|
# Copier le fichier de sauvegarde de la base de données sur l'hôte distant et le restaurer dans la base de données 'sdis2023'
|
||||||
|
#- name: 5. Copie de la sauvegarde de la base de données sur l'hôte distant
|
||||||
|
#copy:
|
||||||
|
#src: sdis2023.sql
|
||||||
|
# dest: /tmp/
|
||||||
|
# login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
|
#- name: 6. Restaurer la base de données
|
||||||
|
#community.mysql.mysql_db:
|
||||||
|
#name: sdis2023.sql
|
||||||
|
#state: import
|
||||||
|
#target: /tmp/
|
||||||
|
#login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
#- name: Restore d
|
#- name: Restore d
|
||||||
#community.mysql.mysql_db:
|
#community.mysql.mysql_db:
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: apdbdump
|
- name: apdbdump
|
||||||
hosts: web
|
hosts: web
|
||||||
|
become: yes
|
||||||
- name: 1. recuperation de sdis2023.sql avec fetch
|
tasks:
|
||||||
ansible.builtin.fetch:
|
- name: 1. recuperation de sdis2023.sql avec fetch
|
||||||
src: /tmp/sdis2023.sql
|
ansible.builtin.fetch:
|
||||||
dest: ~/ansible/backup/
|
src: /tmp/sdis2023.sql
|
||||||
flat: yes
|
dest: ~/ansible/backup/
|
||||||
|
flat: yes
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user