# mysql\_user module error "failed to parse"

**URL:** <https://forum.ansible.com/t/mysql-user-module-error-failed-to-parse/14856>\
**Category:** Ansible Project\
**Created:** [March 25, 2014, 5:09pm UTC](https://forum.ansible.com/t/mysql-user-module-error-failed-to-parse/14856 "2014-03-25T17:09:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [March 25, 2014, 5:09pm UTC](https://forum.ansible.com/t/mysql-user-module-error-failed-to-parse/14856/1 "2014-03-25T17:09:55Z")

</div>

This task:

- name: test1  
mysql\_user: name={{ item.name }} password={{ item.password }} host={{ item.host }} priv={{ item.priv }} state=present login\_user=root login\_password=rtAtJ8NaWvRX6EJsLPiixm  
with\_items:
- { name: ‘hibbert\_admin’, password: ‘Fi4iKbwuoNyfK3KsNMThDn’, host: ‘10.209.104.19’, priv: ‘_._:ALL’ }

Is resulting in the following error:

TASK: [hibbert\_db | test1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [q-mysql01] =\> failed to parse:  
SUDO-SUCCESS-msjntpckybyqqlzjnhyleigbtnhouzjy  
Traceback (most recent call last):  
File “/tmp/ansible-tmp-1395766982.93-90997544941085/mysql\_user”, line 1539, in   
main()  
File “/tmp/ansible-tmp-1395766982.93-90997544941085/mysql\_user”, line 459, in main  
changed = user\_add(cursor, user, host, password, priv)  
File “/tmp/ansible-tmp-1395766982.93-90997544941085/mysql\_user”, line 158, in user\_add  
cursor.execute(“CREATE USER %s@%s IDENTIFIED BY %s”, (user,host,password))  
File “/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py”, line 173, in execute  
self.errorhandler(self, exc, value)  
File “/usr/lib64/python2.6/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler  
raise errorclass, errorvalue  
\_mysql\_exceptions.OperationalError: (1396, “Operation CREATE USER failed for ‘hibbert\_admin’@‘10.209.104.19’”)

FATAL: all hosts have already failed – aborting

Any ideas why this wouldn’t work? login\_user and login\_password are correct.

---

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [March 25, 2014, 9:05pm UTC](https://forum.ansible.com/t/mysql-user-module-error-failed-to-parse/14856/2 "2014-03-25T21:05:03Z")

</div>

Its always successful the first time but on subsequent runs if the user has been manually modified then it throws this error.

---

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [March 25, 2014, 9:17pm UTC](https://forum.ansible.com/t/mysql-user-module-error-failed-to-parse/14856/3 "2014-03-25T21:17:29Z")

</div>

If the user is deleted manually ansible cannot create the user if the mysql\_user: contains a host=

If the mysql\_user does not contain a host= field then the user is created on subsequent plays.

---

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [March 25, 2014, 11:34pm UTC](https://forum.ansible.com/t/mysql-user-module-error-failed-to-parse/14856/4 "2014-03-25T23:34:43Z")

</div>

Could this be a bug in ansible?
