mise à jour
This commit is contained in:
parent
9a9122c181
commit
e8cf17309b
@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: apbase
|
||||
- name: apdb
|
||||
hosts: web
|
||||
become: yes
|
||||
tasks:
|
||||
@ -8,37 +8,56 @@
|
||||
apt:
|
||||
name:
|
||||
- mariadb-server
|
||||
- python3-PyMySQL
|
||||
- python3-pymysql
|
||||
state: present
|
||||
|
||||
- name: 2. s'assurer que mariadb est en fonctionnement
|
||||
service:
|
||||
name: mariadb-server
|
||||
name: mariadb
|
||||
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:
|
||||
name: admin
|
||||
password: admin
|
||||
priv: '*.*:ALL'
|
||||
name: slamers
|
||||
password: slamers
|
||||
priv: '*.*:ALL,GRANT'
|
||||
state: present
|
||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||
|
||||
- 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:
|
||||
name: sdis2023
|
||||
state: import
|
||||
target: /tmp/sdis2023
|
||||
state: present
|
||||
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
|
||||
#community.mysql.mysql_db:
|
||||
|
@ -1,10 +1,11 @@
|
||||
---
|
||||
- name: apdbdump
|
||||
hosts: web
|
||||
|
||||
- name: 1. recuperation de sdis2023.sql avec fetch
|
||||
ansible.builtin.fetch:
|
||||
src: /tmp/sdis2023.sql
|
||||
dest: ~/ansible/backup/
|
||||
flat: yes
|
||||
become: yes
|
||||
tasks:
|
||||
- name: 1. recuperation de sdis2023.sql avec fetch
|
||||
ansible.builtin.fetch:
|
||||
src: /tmp/sdis2023.sql
|
||||
dest: ~/ansible/backup/
|
||||
flat: yes
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user