mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-06 10:40:36 -07:00
Add test to verify TLS requirements are removed
This commit is contained in:
parent
b3a22390f0
commit
4fa9719c75
2 changed files with 27 additions and 0 deletions
|
@ -210,6 +210,11 @@ EXAMPLES = r'''
|
||||||
subject: '/CN=alice/O=MyDom, Inc./C=US/ST=Oregon/L=Portland'
|
subject: '/CN=alice/O=MyDom, Inc./C=US/ST=Oregon/L=Portland'
|
||||||
cipher: 'ECDHE-ECDSA-AES256-SHA384'
|
cipher: 'ECDHE-ECDSA-AES256-SHA384'
|
||||||
|
|
||||||
|
- name: Modify user to no longer require SSL.
|
||||||
|
community.mysql.mysql_user:
|
||||||
|
name: bob
|
||||||
|
tls_requires:
|
||||||
|
|
||||||
- name: Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials.
|
- name: Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials.
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
login_user: root
|
login_user: root
|
||||||
|
|
|
@ -275,6 +275,28 @@
|
||||||
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)
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
- 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') }}"
|
||||||
|
|
||||||
- include: remove_user.yml user_name={{user_name_1}} user_password={{ user_password_1 }}
|
- include: remove_user.yml user_name={{user_name_1}} user_password={{ user_password_1 }}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue