Make 'when' conditions uniform

This commit is contained in:
R. Sicart 2021-12-01 17:34:17 +01:00
commit 66cf9dd369

View file

@ -1490,34 +1490,26 @@
that: that:
- result is failed - result is failed
- result.msg is search('option can be used only with MariaDB') - result.msg is search('option can be used only with MariaDB')
when: when: install_type == 'mysql'
# Semantically, when there's MySQL
- srv['version']['major'] < 10
- name: Check with MariaDB - name: Check with MariaDB
assert: assert:
that: that:
- result is changed - result is changed
when: when: install_type == 'mariadb'
# Semantically, when there's MariaDB
- srv['version']['major'] >= 10
- name: Check in DB - name: Check in DB
<<: *task_params <<: *task_params
mysql_query: mysql_query:
<<: *mysql_params <<: *mysql_params
query: "SELECT 1 FROM mysql.user WHERE User = '{{ role0 }}' AND Host = '%'" query: "SELECT 1 FROM mysql.user WHERE User = '{{ role0 }}' AND Host = '%'"
when: when: install_type == 'mariadb'
# Semantically, when there's MariaDB
- srv['version']['major'] >= 10
- name: Check - name: Check
assert: assert:
that: that:
- result.rowcount.0 == 1 - result.rowcount.0 == 1
when: when: install_type == 'mariadb'
# Semantically, when there's MariaDB
- srv['version']['major'] >= 10
- name: Create role with admin again - name: Create role with admin again
<<: *task_params <<: *task_params
@ -1533,17 +1525,13 @@
that: that:
- result is failed - result is failed
- result.msg is search('option can be used only with MariaDB') - result.msg is search('option can be used only with MariaDB')
when: when: install_type == 'mysql'
# Semantically, when there's MySQL
- srv['version']['major'] < 10
- name: Check with MariaDB - name: Check with MariaDB
assert: assert:
that: that:
- result is not changed - result is not changed
# Semantically, when there's MariaDB when: install_type == 'mariadb'
when:
- srv['version']['major'] >= 10
# Try to grant a role to a user who does not exist # Try to grant a role to a user who does not exist
- name: Create role with admin again - name: Create role with admin again
@ -1561,9 +1549,7 @@
that: that:
- result is failed - result is failed
- result.msg is search('does not exist') - result.msg is search('does not exist')
when: when: install_type == 'mysql'
# Semantically, when there's MySQL
- srv['version']['major'] < 10
always: always:
# Clean up # Clean up