mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2026-02-04 07:11:49 +00:00
* mysql_user: fix crash when default role is set * tests: add DEFAULT role to user to force the module to fail * Add changelog fragment --------- Co-authored-by: “tkr” <“tim.kruth@wiit.cloud”>
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
---
|
|
- vars:
|
|
mysql_parameters: &mysql_params
|
|
login_user: '{{ mysql_user }}'
|
|
login_password: '{{ mysql_password }}'
|
|
login_host: '{{ mysql_host }}'
|
|
login_port: '{{ mysql_primary_port }}'
|
|
|
|
block:
|
|
- name: Issue-710 | Create user with DEFAULT privileges
|
|
community.mysql.mysql_user:
|
|
<<: *mysql_params
|
|
name: "{{ user_name_1 }}"
|
|
password: "{{ user_password_1 }}"
|
|
state: present
|
|
|
|
- name: Issue-710 | Create role to use as default
|
|
community.mysql.mysql_role:
|
|
<<: *mysql_params
|
|
name: developers
|
|
state: present
|
|
priv: '*.*:ALL'
|
|
members:
|
|
- "{{ user_name_1 }}@localhost"
|
|
|
|
- name: Issue-710 | Set default role for db_user1
|
|
community.mysql.mysql_query:
|
|
<<: *mysql_params
|
|
query: >-
|
|
SET DEFAULT ROLE developers {{ (db_engine == 'mysql') | ternary('TO', 'FOR') }} {{ user_name_1 }}@localhost
|
|
|
|
- name: Issue-710 | Ensure db_user1 can still be altered
|
|
community.mysql.mysql_user:
|
|
<<: *mysql_params
|
|
name: "{{ user_name_1 }}"
|
|
password: "{{ user_password_1 }}"
|
|
priv: '*.*:ALL'
|
|
state: present
|
|
|
|
- name: Issue-710 | Ensure mysql_info can still be executed
|
|
community.mysql.mysql_info:
|
|
<<: *mysql_params
|
|
filter: users_info
|