Skip to content

MariaDB, parsing roles failed. #231

@pookey

Description

@pookey
SUMMARY

When trying to manager a user with roles applied the user module appears to fail to parse existing grants.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

mysql_user

ANSIBLE VERSION
ansible [core 2.11.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.6.13 (default, Mar 10 2021, 18:30:35) [GCC]
  jinja version = 2.10.1
  libyaml = False
COLLECTION VERSION
# ansible-galaxy collection list community.mysql
# /usr/lib/python3.6/site-packages/ansible_collections
Collection      Version
--------------- -------
community.mysql 2.3.0
CONFIGURATION
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 30
DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = smart
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/hosts']
DEFAULT_INTERNAL_POLL_INTERVAL(/etc/ansible/ansible.cfg) = 0.0001
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /etc/ansible/ansible.log
DEFAULT_POLL_INTERVAL(/etc/ansible/ansible.cfg) = 1
DEFAULT_STRATEGY(/etc/ansible/ansible.cfg) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/tmp/mitogen/ansible_mitogen/plugins/strategy']
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 30
OS / ENVIRONMENT

OpenSuse 15.3 / MariaDB 10.6.4

STEPS TO REPRODUCE
 - name: Grant full perms for maxscale
   community.mysql.mysql_user:
     state: present
     name: '{{ maxscale_user }}'
     password: '{{ maxscale_password }}'
     host: '%'
     login_unix_socket: '{{ mysql_sock }}'
     priv:
       '*.*': 'SHOW DATABASES,REPLICATION SLAVE,REPLICATION SLAVE ADMIN,SLAVE MONITOR'

Running a show grants for this user shows this:

> show grants for `shardadmin`@`%`;
GRANT `my_role` TO `shardadmin`@`%` WITH ADMIN OPTION
EXPECTED RESULTS

roles should be parsed.

ACTUAL RESULTS
The full traceback is:
  File "master:/usr/lib/python3.6/site-packages/ansible_collections/community/mysql/plugins/modules/mysql_user.py", line 436, in main
  File "master:/usr/lib/python3.6/site-packages/ansible_collections/community/mysql/plugins/module_utils/user.py", line 297, in user_mod
    curr_priv = privileges_get(cursor, user, host, maria_role)
  File "master:/usr/lib/python3.6/site-packages/ansible_collections/community/mysql/plugins/module_utils/user.py", line 426, in privileges_get
    raise InvalidPrivsError('unable to parse the MySQL grant string: %s' % grant[0])
fatal: [dbshard1a.dev02.jupix.net]: FAILED! => {

without debug:

TASK [dbshard : Grant full perms for shardadmin] *******************************
fatal: [dbshard]: FAILED! => {"changed": false, "msg": "unable to parse the MySQL grant string: GRANT `my_role` TO `shardadmin`@`%` WITH ADMIN OPTION"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions