---

### tags:

- name: "Destroy <{{ target_database }}>"
  community.mysql.mysql_db:
    name: "{{ target_database }}"
    state: absent
    login_unix_socket: /var/run/mysqld/mysqld.sock
    login_password: "{{ mysql_root_password }}"

- name: "Import database from <{{ upload_directory }}/{{ database_backup_file }}> to <{{ target_database }}>"
  community.mysql.mysql_db:
    name: "{{ target_database }}"
    state: import
    target: "/{{ upload_directory }}/{{ database_backup_file }}"
    login_unix_socket: /var/run/mysqld/mysqld.sock
    login_password: "{{ mysql_root_password }}"
