mysql_user module error "failed to parse"

38 views
Skip to first unread message

David Neudorfer

unread,
Mar 25, 2014, 1:09:55 PM3/25/14
to ansible...@googlegroups.com
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 <module>
    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.

David Neudorfer

unread,
Mar 25, 2014, 5:05:03 PM3/25/14
to ansible...@googlegroups.com
Its always successful the first time but on subsequent runs if the user has been manually modified then it throws this error.

David Neudorfer

unread,
Mar 25, 2014, 5:17:29 PM3/25/14
to ansible...@googlegroups.com
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.

David Neudorfer

unread,
Mar 25, 2014, 7:34:43 PM3/25/14
to ansible...@googlegroups.com
Could this be a bug in ansible?
Reply all
Reply to author
Forward
0 new messages