# issues with mysql\_user module, GRANT ALL not working

**URL:** <https://forum.ansible.com/t/issues-with-mysql-user-module-grant-all-not-working/28188>\
**Category:** Ansible Project\
**Created:** [July 30, 2018, 8:55am UTC](https://forum.ansible.com/t/issues-with-mysql-user-module-grant-all-not-working/28188 "2018-07-30T08:55:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Nutts](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@Alex\_Nutts](https://forum.ansible.com/u/Alex_Nutts)\
**Post date:** [July 30, 2018, 8:55am UTC](https://forum.ansible.com/t/issues-with-mysql-user-module-grant-all-not-working/28188/1 "2018-07-30T08:55:14Z")

</div>

Dear community,

I’d like to apply this grant: GRANT ALL PRIVILEGES ON opennebula.\* TO ‘oneadmin’ IDENTIFIED BY ‘password’ so I’m using the below listed role:

```auto
# roles/mariadb/tasks/users.yml
---

- name: Remove anonymous users
  mysql_user:
    name: ''
    host_all: true
    login_user: root
    login_password: "{{ mariadb_root_password }}"
    state: absent
  tags: mariadb

- name: Create the users
  mysql_user:
    name: oneadmin
    password: 'password'
    priv: 'opennebula.*:ALL'
    append_privs: yes
    login_user: root
    login_password: "{{ mariadb_root_password }}"
    state: present
  tags: mariadb

I run it

-------------------
TASK [mariadb : Remove anonymous users] *************************************************************************************************************************
ok: [10.10.228.10]

TASK [mariadb : Create the users] *******************************************************************************************************************************
ok: [10.10.228.10]

----------------

on the target host:

MariaDB [(none)]> show grants for oneadmin;
ERROR 1141 (42000): There is no such grant defined for user 'oneadmin' on host '%'
MariaDB [(none)]> SELECT User, Host, Password FROM mysql.user;
+----------+---------------------------------------------+-------------------------------------------+
> User | Host | Password |
+----------+---------------------------------------------+-------------------------------------------+
> root | localhost | *697408D5AC32C63B9FBD5553BC305BB05F9E9B93 |
> root | dssfsdfsdfsdffds | |
> root | 127.0.0.1 | *697408D5AC32C63B9FBD5553BC305BB05F9E9B93 |
> root | ::1 | *697408D5AC32C63B9FBD5553BC305BB05F9E9B93 |
> oneadmin | localhost | *24E63683735E54D886487AD7025B8F6881B0B869 |
> oneadmin | ::1 | *24E63683735E54D886487AD7025B8F6881B0B869 |
+----------+---------------------------------------------+-------------------------------------------+

```

For some reason the GRANT ALL doesn’t get applied when run with Ansible because if I run it manually I get:

MariaDB [(none)]\> GRANT ALL PRIVILEGES ON opennebula.\* TO ‘oneadmin’ IDENTIFIED BY ‘password’;  
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]\> show grants for oneadmin;
