mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-27 16:31:47 -07:00
Backport small diff from main
This commit is contained in:
parent
4fc9c2d57d
commit
de2077cc0c
3 changed files with 20 additions and 16 deletions
|
@ -107,10 +107,10 @@
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Get user information
|
- name: Get user information
|
||||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
command: "{{ mysql_command }} -e \"SELECT user, host, plugin FROM mysql.user WHERE user = '{{ test_user_name }}' and host = 'localhost'\""
|
||||||
register: show_create_user
|
register: show_create_user
|
||||||
|
|
||||||
- name: Check that the module made a change and that the expected plugin type is set
|
- name: Check that the module made a change
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
@ -145,6 +145,7 @@
|
||||||
plugin_hash_string: '{{ test_plugin_hash }}'
|
plugin_hash_string: '{{ test_plugin_hash }}'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
# FIXME: on mariadb 10.2 there's always a change
|
||||||
- name: Check that the module doesn't make a change when the same hash is passed in
|
- name: Check that the module doesn't make a change when the same hash is passed in
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
|
@ -201,7 +202,7 @@
|
||||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||||
register: show_create_user
|
register: show_create_user
|
||||||
|
|
||||||
- name: Check that the module made a change and that the expected plugin type is set
|
- name: Check that the module made a change
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
@ -210,6 +211,7 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'{{ test_plugin_type }}' in show_create_user.stdout"
|
- "'{{ test_plugin_type }}' in show_create_user.stdout"
|
||||||
|
when: install_type == 'mysql' or (install_type == 'mariadb' and mariadb_version is version('10.3', '>='))
|
||||||
|
|
||||||
- include: assert_user.yml user_name={{ test_user_name }} priv={{ test_default_priv_type }}
|
- include: assert_user.yml user_name={{ test_user_name }} priv={{ test_default_priv_type }}
|
||||||
|
|
||||||
|
@ -290,7 +292,7 @@
|
||||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||||
register: show_create_user
|
register: show_create_user
|
||||||
|
|
||||||
- name: Check that the module made a change and that the expected plugin type is set
|
- name: Check that the module made a change
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
@ -376,7 +378,7 @@
|
||||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||||
register: show_create_user
|
register: show_create_user
|
||||||
|
|
||||||
- name: Check that the module made a change and that the expected plugin type is set
|
- name: Check that the module made a change
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
@ -401,7 +403,7 @@
|
||||||
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
command: "{{ mysql_command }} -e \"SHOW CREATE USER '{{ test_user_name }}'@'localhost'\""
|
||||||
register: show_create_user
|
register: show_create_user
|
||||||
|
|
||||||
- name: Check that the module made a change and that the expected plugin type is set
|
- name: Check that the module made a change
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
issuer: '/CN=org/O=MyDom, Inc./C=US/ST=Oregon/L=Portland'
|
issuer: '/CN=org/O=MyDom, Inc./C=US/ST=Oregon/L=Portland'
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: retrieve TLS requiremets for users in old database version
|
- name: retrieve TLS requirements for users in old database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ item }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ item }}'@'localhost'\""
|
||||||
register: old_result
|
register: old_result
|
||||||
with_items: ['{{ user_name_1 }}', '{{ user_name_2 }}', '{{ user_name_3 }}']
|
with_items: ['{{ user_name_1 }}', '{{ user_name_2 }}', '{{ user_name_3 }}']
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: retrieve TLS requiremets for users in new database version
|
- name: retrieve TLS requirements for users in new database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ item }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ item }}'@'localhost'\""
|
||||||
register: new_result
|
register: new_result
|
||||||
with_items: ['{{ user_name_1 }}', '{{ user_name_2 }}', '{{ user_name_3 }}']
|
with_items: ['{{ user_name_1 }}', '{{ user_name_2 }}', '{{ user_name_3 }}']
|
||||||
|
@ -119,12 +119,12 @@
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: retrieve TLS requiremets for users in old database version
|
- name: retrieve TLS requirements for users in old database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ user_name_1 }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ user_name_1 }}'@'localhost'\""
|
||||||
register: old_result
|
register: old_result
|
||||||
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
||||||
|
|
||||||
- name: retrieve TLS requiremets for users in new database version
|
- name: retrieve TLS requirements for users in new database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ user_name_1 }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ user_name_1 }}'@'localhost'\""
|
||||||
register: new_result
|
register: new_result
|
||||||
when: db_version.version.major == 5 and db_version.version.minor >= 7 or db_version.version.major > 5 and db_version.version.major < 10 or db_version.version.major == 10 and db_version.version.minor >= 2
|
when: db_version.version.major == 5 and db_version.version.minor >= 7 or db_version.version.major > 5 and db_version.version.major < 10 or db_version.version.major == 10 and db_version.version.minor >= 2
|
||||||
|
@ -143,12 +143,12 @@
|
||||||
tls_requires:
|
tls_requires:
|
||||||
X509:
|
X509:
|
||||||
|
|
||||||
- name: retrieve TLS requiremets for users in old database version
|
- name: retrieve TLS requirements for users in old database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ user_name_1 }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ user_name_1 }}'@'localhost'\""
|
||||||
register: old_result
|
register: old_result
|
||||||
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
||||||
|
|
||||||
- name: retrieve TLS requiremets for users in new database version
|
- name: retrieve TLS requirements for users in new database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ user_name_1 }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ user_name_1 }}'@'localhost'\""
|
||||||
register: new_result
|
register: new_result
|
||||||
when: db_version.version.major == 5 and db_version.version.minor >= 7 or db_version.version.major > 5 and db_version.version.major < 10 or db_version.version.major == 10 and db_version.version.minor >= 2
|
when: db_version.version.major == 5 and db_version.version.minor >= 7 or db_version.version.major > 5 and db_version.version.major < 10 or db_version.version.major == 10 and db_version.version.minor >= 2
|
||||||
|
@ -159,19 +159,19 @@
|
||||||
vars:
|
vars:
|
||||||
- reqs: "{{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip()}}"
|
- reqs: "{{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip()}}"
|
||||||
|
|
||||||
- name: remove TLS requiremets from user (expect changed=true)
|
- name: remove TLS requirements from user (expect changed=true)
|
||||||
mysql_user:
|
mysql_user:
|
||||||
<<: *mysql_params
|
<<: *mysql_params
|
||||||
name: '{{ user_name_1 }}'
|
name: '{{ user_name_1 }}'
|
||||||
password: '{{ user_password_1 }}'
|
password: '{{ user_password_1 }}'
|
||||||
tls_requires:
|
tls_requires:
|
||||||
|
|
||||||
- name: retrieve TLS requiremets for users in old database version
|
- name: retrieve TLS requirements for users in old database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ user_name_1 }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ user_name_1 }}'@'localhost'\""
|
||||||
register: old_result
|
register: old_result
|
||||||
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
when: db_version.version.major <= 5 and db_version.version.minor <= 6 or db_version.version.major == 10 and db_version.version.minor < 2
|
||||||
|
|
||||||
- name: retrieve TLS requiremets for users in new database version
|
- name: retrieve TLS requirements for users in new database version
|
||||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ user_name_1 }}'@'localhost'\""
|
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ user_name_1 }}'@'localhost'\""
|
||||||
register: new_result
|
register: new_result
|
||||||
when: db_version.version.major == 5 and db_version.version.minor >= 7 or db_version.version.major > 5 and db_version.version.major < 10 or db_version.version.major == 10 and db_version.version.minor >= 2
|
when: db_version.version.major == 5 and db_version.version.minor >= 7 or db_version.version.major > 5 and db_version.version.major < 10 or db_version.version.major == 10 and db_version.version.minor >= 2
|
||||||
|
|
|
@ -359,7 +359,9 @@
|
||||||
|
|
||||||
- include: assert_var.yml changed=true output={{ result }} var_name={{ set_name }} var_value='{{ def_val }}'
|
- include: assert_var.yml changed=true output={{ result }} var_name={{ set_name }} var_value='{{ def_val }}'
|
||||||
|
|
||||||
when: mysql_version is not version('8.0', '<')
|
when:
|
||||||
|
- mysql_version is version('8.0', '>=')
|
||||||
|
- install_type == 'mysql'
|
||||||
|
|
||||||
# Bugfix of https://github.com/ansible/ansible/issues/54239
|
# Bugfix of https://github.com/ansible/ansible/issues/54239
|
||||||
# - name: set variable containing dot
|
# - name: set variable containing dot
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue