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:
# 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;