# failed to parse:  SUDO-SUCCESS-ugbdmgqomyttgubummftugavvodrnugl when using mysql\_user with password lookup

**URL:** <https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564>\
**Category:** Ansible Project\
**Created:** [February 13, 2014, 7:00pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564 "2014-02-13T19:00:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_Hall-BrandFo](https://avatars.discourse-cdn.com/v4/letter/w/aca169/32.png) [@William\_Hall-BrandFo](https://forum.ansible.com/u/William_Hall-BrandFo)\
**Post date:** [February 13, 2014, 7:00pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/1 "2014-02-13T19:00:31Z")

</div>

Similar to this discussion [https://groups.google.com/d/msg/ansible-project/aBE51ToAC7A/QC3jwdPOK4MJ](https://groups.google.com/d/msg/ansible-project/aBE51ToAC7A/QC3jwdPOK4MJ)

I am getting this error:

failed to parse: SUDO-SUCCESS-ugbdmgqomyttgubummftugavvodrnugl

I am trying to make use of the password lookup in mysql\_user like so

- name: create and/or update database user  
mysql\_user:  
login\_user={{ mysqluser }}  
login\_password={{ mysqlpassword }}  
name={{ databaseuser }}  
password={{ lookup(‘password’, ‘/tmp/passwordfile length=15’) }}  
append\_privs=yes  
priv={{ databasename }}.\*:SELECT,INSERT,UPDATE,DELETE

I was previously using a similar play to get a password via an api and that worked so I know the syntax is correct, its just the introduction of the password lookup which seems to have broken things.

Client: Mac OS X 10.6.8  
Server: Debian 7

Any ideas?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [February 17, 2014, 4:11pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/2 "2014-02-17T16:11:42Z")

</div>

Are you using sudo to execute this? In that case, you may be hitting this bug:

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

There are pull-requests open to address this, which I will be looking to test today.

---

<div class="post-metadata">

**Author:** ![William\_Hall-BrandFo](https://avatars.discourse-cdn.com/v4/letter/w/aca169/32.png) [@William\_Hall-BrandFo](https://forum.ansible.com/u/William_Hall-BrandFo)\
**Post date:** [March 14, 2014, 11:10am UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/3 "2014-03-14T11:10:20Z")

</div>

I never got the message to say there was a reply so sorry for the delay in getting back to you.

I have disabled sudo for that play and updated to ansible 1.5.3.

The play now works but does not create a file at /tmp/passwordfile and if I try to use an alternative directory, it errors completely differently

failed: [[g.b4dev.com](http://g.b4dev.com)] =\> {“failed”: true, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/home/wh/.ansible/tmp/ansible-tmp-1394795091.79-153729821362509/mysql\_user”, line 1561, in   
main()  
File “/home/wh/.ansible/tmp/ansible-tmp-1394795091.79-153729821362509/mysql\_user”, line 459, in main  
changed = user\_add(cursor, user, host, password, priv)  
File “/home/wh/.ansible/tmp/ansible-tmp-1394795091.79-153729821362509/mysql\_user”, line 158, in user\_add  
cursor.execute(“CREATE USER %s@%s IDENTIFIED BY %s”, (user,host,password))  
File “/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py”, line 174, in execute  
self.errorhandler(self, exc, value)  
File “/usr/lib/python2.7/dist-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler  
raise errorclass, errorvalue  
\_mysql\_exceptions.OperationalError: (1396, “Operation CREATE USER failed for ‘test’@‘localhost’”)

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [March 14, 2014, 2:58pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/4 "2014-03-14T14:58:05Z")

</div>

What happens if you use debug: var={{ lookup('password', '/tmp/passwordfile  
length=15') }} ?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [March 14, 2014, 3:01pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/5 "2014-03-14T15:01:48Z")

</div>

Really though, this seems like your mysqluser/mysqlpassword variables are  
incorrect, or the user you're connecting as does not have the proper GRANT  
permissions to add/edit the user.

Can you run other actions with that user/passord?

---

<div class="post-metadata">

**Author:** ![William\_Hall-BrandFo](https://avatars.discourse-cdn.com/v4/letter/w/aca169/32.png) [@William\_Hall-BrandFo](https://forum.ansible.com/u/William_Hall-BrandFo)\
**Post date:** [March 14, 2014, 3:04pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/6 "2014-03-14T15:04:42Z")

</div>

The MySQL account I use should be all singing all dancing.

I think I may have figured it out.

The debug command came back with a value but I couldn’t find the passwordfile and then it occurred to me that the file might be local and sure enough it was.

Did I miss the part where the file lookup works on local files and not remote files?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [March 14, 2014, 3:39pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/7 "2014-03-14T15:39:50Z")

</div>

Yes, all lookups like that (and action\_plugins too) occur locally on the machine running ansible, not remotely. Looking through [http://docs.ansible.com/playbooks\_lookups.html](http://docs.ansible.com/playbooks_lookups.html), it does not mention that specifically, so it would be good to add. Please feel free to open up a github issue for that.

Thanks!

---

<div class="post-metadata">

**Author:** ![William\_Hall-BrandFo](https://avatars.discourse-cdn.com/v4/letter/w/aca169/32.png) [@William\_Hall-BrandFo](https://forum.ansible.com/u/William_Hall-BrandFo)\
**Post date:** [March 14, 2014, 4:03pm UTC](https://forum.ansible.com/t/failed-to-parse-sudo-success-ugbdmgqomyttgubummftugavvodrnugl-when-using-mysql-user-with-password-lookup/14564/8 "2014-03-14T16:03:32Z")

</div>

Done and done. Thank you for your help! 🙂
