mysql_user module and LOCK TABLES

I am trying to run the following:

  • name: gitlab | mysql | ensure database user gitlab has necessary privleges
    mysql_user: state=present name=gitlab priv=gitlabhq_production.*:SELECT,LOCK TABLES,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER

The “LOCK TABLES” priv is a problem though since it has a space. Is there any way around this?

TASK: [gitlab | mysql | ensure database user gitlab has necessary privileges] *** 
failed: [192.168.0.13] => {"failed": true, "item": ""}
msg: this module requires key=value arguments (['state=present', 'name=gitlab', 'priv=gitlabhq_production.*:SELECT,LOCK', 'TABLES,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER'])

Escape the space: “LOCK\ TABLES”. The parsing is done by the python shlex module if I remember right, so this should get you past the issue.

Doh, I should have known. Thanks that worked.

An easier way do to this would be to just quote the entire string.

shlex understands quotes and is pretty smart.

priv=“gitlabhq_production.*:SELECT,LOCK TABLES,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER”

Can you please cross check this
Im trying to create a user but it gets executed but the user is not getting created in my RDS mysql DB .