Skip to content

mysql_role fails to parse show grant response from mysql #632

@sascha-andres

Description

@sascha-andres

Summary

I have a role applied to another user role along with privileges. Now there comes a parsing error:

"unable to parse the MySQL grant string: GRANT app_role_aa_bbbbb_cccc_dddd TO 'role_cccccc_dddddd'"

The role was assigned using a member in another role definition

Issue Type

Bug Report

Component Name

mysql

Ansible Version

$ ansible --version

ansible [core 2.16.4]
  config file = /home/eeeeee/dev/ffff/ansible.cfg
  configured module search path = ['/home/eeeeee/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/eeeeee/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] (/usr/bin/python)
  jinja version = 3.1.3
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all

CONFIG_FILE() = /home/eeeeee/dev/ffff/ansible.cfg
DEFAULT_LOG_PATH(/home/eeeeee/dev/ffff/ansible.cfg) = /home/eeeeee/dev/ffff/ansible.log
DEFAULT_REMOTE_USER(/home/eeeeee/dev/ffff/ansible.cfg) = automation
DEFAULT_ROLES_PATH(/home/eeeeee/dev/ffff/ansible.cfg) = ['/home/eeeeee/dev/platform/ffff/galaxy_roles', '/home/eeeeee/dev/ffff/roles']
DEFAULT_STDOUT_CALLBACK(/home/andres/dev/platform/iq-baremetal/ansible/ansible.cfg) = community.general.unixy
DEPRECATION_WARNINGS(/home/eeeeee/dev/ffff/ansible.cfg) = False
EDITOR(env: EDITOR) = code
HOST_KEY_CHECKING(/home/eeeeee/dev/ffff/ansible.cfg) = False
INVENTORY_ENABLED(/home/eeeeee/dev/ffff/ansible.cfg) = ['yaml']

CONNECTION:
==========

paramiko_ssh:
____________
host_key_checking(/home/eeeeee/dev/ffff/ansible.cfg) = False
remote_user(/home/eeeeee/dev/ffff/ansible.cfg) = automation
ssh_args(/home/eeeeee/dev/ffff/ansible.cfg) = -o ForwardAgent=yes

ssh:
___
host_key_checking(/home/eeeeee/dev/ffff/ansible.cfg) = False
remote_user(/home/eeeeee/dev/ffff/ansible.cfg) = ansibleuser
ssh_args(/home/eeeeee/dev/ffff/ansible.cfg) = -o ForwardAgent=yes

OS / Environment

1 │ DISTRIB_ID="ManjaroLinux"␊
2 │ DISTRIB_RELEASE="23.1.4"␊
3 │ DISTRIB_CODENAME="Vulcan"␊
4 │ DISTRIB_DESCRIPTION="Manjaro·Linux"␊

Steps to Reproduce

- name: "[APP ROLE] aa_bbbbb cccc r"
  community.mysql.mysql_role:
    name: app_role_aa_bbbbb_cccc_read
    state: present
    members:
      - role_cccccc_dddddd
    priv:
      'schema.table': 'SELECT'

- name: "sascha.andres"
  community.mysql.mysql_user:
    name: "dddddd.eeeeee"
    ...
    state: present
    ...

# this is the default role and serves as a container to be used
# for collecting all roles
- name: "cccccc.dddddd user role"
  community.mysql.mysql_role:
    name: role_cccccc_dddddd
    state: present
    members:
      - 'cccccc.dddddd@%'
    priv:
      'schema.*': 'SELECT'
      'other.gggggg': 'UPDATE'
      .....

Expected Results

Adjusting or recognizing the role definition as ok

Actual Results

"unable to parse the MySQL grant string: GRANT app_role_aa_bbbbb_cccc_dddd TO 'role_cccccc_dddddd'"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions