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 - name: 3. Creer un utilisateur et lui attribuer tous les droits
community.mysql.mysql_user: community.mysql.mysql_user:
name: slamers name: admin
password: slamers password: admin
priv: '*.*:ALL,GRANT' priv: '*.*:ALL,GRANT'
state: present state: present
login_unix_socket: /var/run/mysqld/mysqld.sock login_unix_socket: /var/run/mysqld/mysqld.sock
@ -30,40 +30,23 @@
state: present state: present
login_unix_socket: /var/run/mysqld/mysqld.sock login_unix_socket: /var/run/mysqld/mysqld.sock
# - name: Cration de la base de donnée - name: 5. copier la base de donnée sur l'hôte distant
# mysql_db: copy:
#name: "{{ sdis2023 }}" src: /tmp/sdis2023.sql
# login_host: "{{ root }}" dest: /tmp/sdis2023.sql
# login_user: "{{ root }}"
#login_password: "{{ root }}"
#state: present
#- name: 3. Creer un utilisateur 'admin' lui attribuer tous les droits - name: 6. Restore la base de donnée
#community.mysql.mysql_user: community.mysql.mysql_db:
#name: admin name: sdis2023
#password: admin state: import
#priv: '*.*:ALL,GRANT' target: /tmp/sdis2023.sql
#state: present login_unix_socket: /var/run/mysqld/mysqld.sock
# 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: 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 become: yes
tasks: tasks:
- name: 1. recuperation de sdis2023.sql avec fetch - name: 1. recuperation de sdis2023.sql avec fetch
ansible.builtin.fetch: ansible.builtin.fetch:
src: /tmp/sdis2023.sql src: /tmp/sdis2023.sql
dest: ~/ansible/backup/ dest: /tmp/sdis2023.sql
flat: yes flat: yes