- name: "[MYSQL] - Démarrage MySQL"
  service:
    name: "mysqld"
    state: started
    enabled: yes

- name: "[MYSQL] - Création de la base de données"
  mysql_db:
    name: sdis29
    check_implicit_admin: yes
    login_unix_socket: /var/run/mysqld/mysqld.sock
    state: present

- name: "[MYSQL] - Création de l'utilisateur"
  mysql_user:
    user: slam
    password: Azerty1+
    priv: "*.*:ALL"
    login_unix_socket: /var/run/mysqld/mysqld.sock
    state: present

- name: Copie du dump
  copy:
    src: files/sdis29.sql
    dest: /tmp

- name: Restaurer la base de données
  mysql_db:
    name: sdis29
    state: import
    target: /tmp/sdis29.sql
    login_user: slam
    login_password: Azerty1+
    login_unix_socket: /var/run/mysqld/mysqld.sock
  notify: Restart MySQL
