--- - name: "check database is empty" shell: "bash roles/database/files/is_empty.sh {{ OS.database.percona.dirs.data }}/{{ mikbill.database.proper.name }}" register: database_empty - name: "import clear data" shell: "mysql --defaults-file={{ mikbill.dirs.tmp }}/root.cnf {{ mikbill.database.proper.name }} < {{ mikbill.dirs.tmp }}/clear_mikbill_database.sql" when: - mikbill.database.restore_from_backup.enabled == 0 - database_empty.stdout == "1" - name: "import custom file: {{ mikbill.database.restore_from_backup.file }}" shell: "mysql --defaults-file={{ mikbill.dirs.tmp }}/root.cnf {{ mikbill.database.proper.name }} < {{ mikbill.database.restore_from_backup.file }}" when: - mikbill.database.restore_from_backup.enabled == 1 - database_empty.stdout == "1"