# mysql\_db import fails the second time / "ignore\_errors : yes" not working

**URL:** <https://forum.ansible.com/t/mysql-db-import-fails-the-second-time-ignore-errors-yes-not-working/13890>\
**Category:** Ansible Project\
**Created:** [November 12, 2013, 1:31pm UTC](https://forum.ansible.com/t/mysql-db-import-fails-the-second-time-ignore-errors-yes-not-working/13890 "2013-11-12T13:31:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [November 12, 2013, 1:31pm UTC](https://forum.ansible.com/t/mysql-db-import-fails-the-second-time-ignore-errors-yes-not-working/13890/1 "2013-11-12T13:31:51Z")

</div>

Hi All,

I have a task that imports a db file into mysql but it fails the second time I re-run the playbook.

In order to overcome the failure I need to login to the mysql server and drop the database in order to import successfully in the second play, this is not possible in a production environment and doesn’t make my code idempotent. Using the ignore errors I still get the same problem causing Ansible to stop the execution on the next play and exit .

# Task :

- name: import DB  
mysql\_db: login\_host={{ DB\_ADDRESS }} login\_user={{ DB\_MASTER\_USERNAME }} login\_password={{ DB\_MASTER\_PASSWORD }} name=mmdb state=import target=roles/mmdb/templates/mmdb-init-tables.sql.j2  
ignore\_errors : yes

# Error message

failed: [localhost] =\> {“failed”: true}  
msg: ERROR 1062 (23000) at line 4: Duplicate entry ‘CM’ for key ‘PRIMARY’

In other tasks the “ignore\_errors: yes” works just fine but that doesn’t seem to be the case for an import failure using the mysql\_db module.

Wondering if I’m doing something wrong or I should submit a ticket ?

Regards,  
Nicolas.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 12, 2013, 1:42pm UTC](https://forum.ansible.com/t/mysql-db-import-fails-the-second-time-ignore-errors-yes-not-working/13890/2 "2013-11-12T13:42:32Z")

</div>

what is ‘ansible --version’ ?

(In any case, ignore\_errors is task agnostic, I suspect the problem is the trailing space before the colon, which is new to me – I’d suspect that to be ignored but seems like it is not. The valid parameter names are checked though so I’d suspect this to raise an error, so again curious about your ansible version.)

Thanks!

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [November 12, 2013, 1:54pm UTC](https://forum.ansible.com/t/mysql-db-import-fails-the-second-time-ignore-errors-yes-not-working/13890/3 "2013-11-12T13:54:12Z")

</div>

ansible 1.4 (devel 6008ea40ee) last updated 2013/11/12 12:34:58 (GMT +000)

removing the space before the colon didn’t fix it.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [November 12, 2013, 2:32pm UTC](https://forum.ansible.com/t/mysql-db-import-fails-the-second-time-ignore-errors-yes-not-working/13890/4 "2013-11-12T14:32:43Z")

</div>

Please file a bug and I'll try to reproduce/fix. Thanks!

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [November 12, 2013, 2:39pm UTC](https://forum.ansible.com/t/mysql-db-import-fails-the-second-time-ignore-errors-yes-not-working/13890/5 "2013-11-12T14:39:11Z")

</div>

done.

[https://github.com/ansible/ansible/issues/4878](https://github.com/ansible/ansible/issues/4878)

Regards,  
Nicolas.
