Skip to content

Commit

Permalink
s/fail/assert for version verification
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrosi committed Jun 21, 2022
1 parent 27201be commit 40ee909
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
13 changes: 6 additions & 7 deletions tasks/main.yml
Expand Up @@ -42,13 +42,12 @@
- mssql_version | int == 2017

- name: Verify that EL < 8 is not used with mssql_ha_configure=true
assert:
that:
- ansible_distribution in ['CentOS', 'RedHat']
- ansible_distribution_version is version('8', '>')
fail_msg: >-
mssql_ha_configure=true does not support running against EL 7 hosts
when: mssql_ha_configure | bool
fail:
msg: mssql_ha_configure=true does not support running against EL 7 hosts
when:
- mssql_ha_configure | bool
- ansible_distribution in ['CentOS', 'RedHat']
- ansible_distribution_version is version('8', '<')

- name: Verify if the mssql_ha_replica_type variable is provided correctly
assert:
Expand Down
7 changes: 6 additions & 1 deletion tests/tests_configure_ha_cluster.yml
Expand Up @@ -18,6 +18,8 @@
- ansible_distribution_version is version('8', '<')
block:
- name: Run the role
vars:
mssql_ha_configure: true
include_role:
name: linux-system-roles.mssql

Expand All @@ -29,7 +31,10 @@
assert:
that: >-
'mssql_ha_configure=true does not support running against EL 7
hosts' in ansible_failed_result.msg.0
hosts' in ansible_failed_result.msg
- name: End EL < 8 host
meta: end_host

- name: Set the mssql_ha_replica_type fact to appear in hostvars
set_fact:
Expand Down

0 comments on commit 40ee909

Please sign in to comment.