mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-07-23 05:10:24 -07:00
Feature/mariadb integration ci (#246)
* Replace matrix.mysql by matrix.db_engine_version * Specify db flavor * Upgrade dbdeployer to 1.56.0 See https://github.com/datacharmer/dbdeployer/issues/120 * Fix: github workflow syntax * Fix: mysql version file for mariadb engine * Do not test mysql_variables modes persist and persist_only on mariadb Those modes do not exist on mariadb. See https://mariadb.com/kb/en/set/ * Exclude integration tests for mariadb_10.5.4 with pymysql==0.7.10 * TLS on mariadb is disabled by default * Configure mariadb supported versions in matrix As discussed in https://github.com/ansible-collections/community.mysql/discussions/141#discussioncomment-643657 * Fix: test_mysql_db : assert that databases does not exist "assertion": "database1 not in mysql_result.stdout" * Fix: assertion mysql_version in result.version.full * Fix: test_mysql_user : Check that the module made a change and that the expected plugin type is set 'mysql_native_password' in show_create_user.stdout * Fix: test_mysql_replication : Create user for replication ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BY 'replication_pass'' at line 1 https://dev.mysql.com/doc/mysql-replication-excerpt/5.7/en/replication-howto-repuser.html https://dev.mysql.com/doc/mysql-replication-excerpt/8.0/en/replication-howto-repuser.html https://mariadb.com/kb/en/setting-up-replication/#example-enabling-replication-for-mariadb Create user syntax compatible with auth plugin and password on both mysql and mariadb. https://dev.mysql.com/doc/refman/8.0/en/create-user.html https://mariadb.com/kb/en/create-user/ * Fix: test_mysql_replication: replica_status 'dict object' has no attribute 'Source_Host' * Do not test mysql_replication_channel.yml on mariadb * Do not test target 'test_mysql_role' with mariadb, too much errors to fix * Setup mysql_version_parts depending on install type (mysql or mariadb) * Install mariadb-client when install_type is mariadb To use the same client tools as the database engine. And to use a more updated mysqldump version, in order to fix this error: ERROR 1556 (HY000) at line 776: You can't use locks with log tables * Fix: mysql auth plugin is set on mariadb >10.2 * Fix: skip assertion on mariadb 10.2 * Do not execute test_user_plugin_auth.yml tests on mariadb, create/update useer sql syntax not compatible * Fix: test_mysql_user : assert user1 TLS requirements Remove test for oldd versions * Fix: typo * Fix: test_mysql_user : Test idempotency (expect ok) ignore mariadb 10.5 * [ci skip] Add changelog fragment * Delete changelog fragment
This commit is contained in:
parent
038a0b07b1
commit
1b061131dd
23 changed files with 195 additions and 58 deletions
|
@ -55,7 +55,7 @@
|
|||
issuer: '/CN=org/O=MyDom, Inc./C=US/ST=Oregon/L=Portland'
|
||||
|
||||
- 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'\""
|
||||
register: old_result
|
||||
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
|
||||
|
||||
- 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'\""
|
||||
register: new_result
|
||||
with_items: ['{{ user_name_1 }}', '{{ user_name_2 }}', '{{ user_name_3 }}']
|
||||
|
@ -119,12 +119,12 @@
|
|||
that:
|
||||
- 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'\""
|
||||
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
|
||||
|
||||
- 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'\""
|
||||
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
|
||||
|
@ -143,12 +143,12 @@
|
|||
tls_requires:
|
||||
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'\""
|
||||
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
|
||||
|
||||
- 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'\""
|
||||
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
|
||||
|
@ -159,28 +159,20 @@
|
|||
vars:
|
||||
- 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_params
|
||||
name: '{{ user_name_1 }}'
|
||||
password: '{{ user_password_1 }}'
|
||||
tls_requires:
|
||||
|
||||
- name: retrieve TLS requiremets for users in old database version
|
||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW GRANTS for '{{ user_name_1 }}'@'localhost'\""
|
||||
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
|
||||
|
||||
- name: retrieve TLS requiremets for users in new database version
|
||||
- name: retrieve TLS requirements for users
|
||||
command: "{{ mysql_command }} -L -N -s -e \"SHOW CREATE USER '{{ user_name_1 }}'@'localhost'\""
|
||||
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
|
||||
register: result
|
||||
|
||||
- name: assert user1 TLS requirements
|
||||
assert:
|
||||
that: "'NONE' in reqs"
|
||||
vars:
|
||||
- reqs: "{{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip() | default('NONE') }}"
|
||||
that: "'REQUIRE ' not in result.stdout or 'REQUIRE NONE' in result.stdout"
|
||||
|
||||
- include: remove_user.yml user_name={{user_name_1}} user_password={{ user_password_1 }}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue