This commit is contained in:
Alhassane Kone 2023-11-24 15:05:57 +01:00
parent e8cf17309b
commit c4f16ca274
2 changed files with 23 additions and 40 deletions

View File

@ -18,8 +18,8 @@
- name: 3. Creer un utilisateur et lui attribuer tous les droits
community.mysql.mysql_user:
name: slamers
password: slamers
name: admin
password: admin
priv: '*.*:ALL,GRANT'
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
@ -30,40 +30,23 @@
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: 5. copier la base de donnée sur l'hôte distant
copy:
src: /tmp/sdis2023.sql
dest: /tmp/sdis2023.sql
#- 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:
#name: my_db
#state: import
#target: /tmp/dump.sql.bz2
#force: true
- name: 6. Restore la base de donnée
community.mysql.mysql_db:
name: sdis2023
state: import
target: /tmp/sdis2023.sql
login_unix_socket: /var/run/mysqld/mysqld.sock
# - name: 5. Dump multiple databases
#community.mysql.mysql_db:
#state: dump
#name:
#- sdis2023
#target: sdis2023.sql
#login_unix_socket: /var/run/mysqld/mysqld.sock

View File

@ -4,8 +4,8 @@
become: yes
tasks:
- name: 1. recuperation de sdis2023.sql avec fetch
ansible.builtin.fetch:
src: /tmp/sdis2023.sql
dest: ~/ansible/backup/
flat: yes
ansible.builtin.fetch:
src: /tmp/sdis2023.sql
dest: /tmp/sdis2023.sql
flat: yes