# mysql\_db unexpected result with priv="database.table:SELECT(collum,collum,collum)"

**URL:** <https://forum.ansible.com/t/mysql-db-unexpected-result-with-priv-database-table-select-collum-collum-collum/13278>\
**Category:** Ansible Project\
**Created:** [August 9, 2013, 2:30pm UTC](https://forum.ansible.com/t/mysql-db-unexpected-result-with-priv-database-table-select-collum-collum-collum/13278 "2013-08-09T14:30:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jean-philippe\_zolesi](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jean-philippe\_zolesi](https://forum.ansible.com/u/jean-philippe_zolesi)\
**Post date:** [August 9, 2013, 2:30pm UTC](https://forum.ansible.com/t/mysql-db-unexpected-result-with-priv-database-table-select-collum-collum-collum/13278/1 "2013-08-09T14:30:29Z")

</div>

Hi,

First of all, sorry for my bad english !

Secondly, for people which are interested to what I’m trying to do. And why it’s seem important to me to have ansible to do what I expect read the end of message.

Here is the problem :

[tasks]

- name: create users

mysql\_user: name={{ item.name }} password={{ item.password }} state=present priv={{ item.priv }}  
login\_user=root login\_password=$mysql\_root\_password login\_unix\_socket=/var/run/mysqld/mysqld.sock  
with\_items: $nss\_config

[config]

nss\_config:

- { name: ‘nss-root’ , password: ‘rootpass’ , priv: ‘_._:USAGE/auth.\*:SELECT’ }
- { name: ‘nss-user’, password: ‘userpass’, priv: ‘_._:USAGE/auth.grouplist:SELECT/auth.groups:SELECT/auth.users:SELECT(username,uid,gid,gecos,homedir,shell)’ }

First launch (and odd):

TASK: [create users] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [test] =\> (item={‘password’: ‘rootpass’, ‘name’: ‘nss-root’, ‘priv’: ‘_._:USAGE/auth._:SELECT’})  
changed: [test] =\> (item={‘password’: ‘userpass’, ‘name’: ‘nss-user’, ‘priv’: '_.\*:USAGE/auth.grouplist:SELECT/auth.groups:SELECT/auth.users:SELECT(username,uid,gid,gecos,homedir,shell)’})

Second launch (and even) :

TASK: [create users] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [test] =\> (item={‘password’: ‘rootpass’, ‘name’: ‘nss-root’, ‘priv’: ‘_._:USAGE/auth.\*:SELECT’})  
fatal: [test] =\> failed to parse: Traceback (most recent call last):  
File “/root/.ansible/tmp/ansible-1376057719.04-198846840431411/mysql\_user”, line 1339, in   
main()  
File “/root/.ansible/tmp/ansible-1376057719.04-198846840431411/mysql\_user”, line 398, in main  
changed = user\_mod(cursor, user, host, password, priv)  
File “/root/.ansible/tmp/ansible-1376057719.04-198846840431411/mysql\_user”, line 183, in user\_mod  
privileges\_revoke(cursor, user,host,db\_table)  
File “/root/.ansible/tmp/ansible-1376057719.04-198846840431411/mysql\_user”, line 256, in privileges\_revoke  
raise e  
\_mysql\_exceptions.OperationalError: (1147, “There is no such grant defined for user ‘nss-user’ on host ‘localhost’ on table ‘users’”)

Why I want to do this :

Implement the installation and configuration of [http://libnss-mysql.sourceforge.net/configuration.shtml#nsswitch](http://libnss-mysql.sourceforge.net/configuration.shtml#nsswitch) with ansible

If I let nss-user have SELECT on user table, so people can steal password. Only nss-root can read password.

Thanks !

Holblin

---

<div class="post-metadata">

**Author:** ![jean-philippe\_zolesi](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jean-philippe\_zolesi](https://forum.ansible.com/u/jean-philippe_zolesi)\
**Post date:** [August 12, 2013, 9:45am UTC](https://forum.ansible.com/t/mysql-db-unexpected-result-with-priv-database-table-select-collum-collum-collum/13278/2 "2013-08-12T09:45:22Z")

</div>

Little up.

I didn’t find solution yet …
