diff --git a/tasks/main.yml b/tasks/main.yml index e1db853f..291b0648 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -51,11 +51,57 @@ 'synchronous', 'witness', 'absent' when: mssql_ha_configure | bool +- debug: + var: ansible_play_hosts_all + +- debug: + var: ansible_play_hosts_all | + map('extract', hostvars, 'mssql_ha_replica_type') + +- debug: + var: ansible_play_hosts_all | + map('extract', hostvars, 'mssql_ha_replica_type') | + list + +- debug: + var: ansible_play_hosts_all | + map('extract', hostvars, 'mssql_ha_replica_type') | + select('match', '^primary$') + +- debug: + var: ansible_play_hosts_all | + map('extract', hostvars, 'mssql_ha_replica_type') | + select('match', '^primary$') | + list + +- debug: + var: ansible_play_hosts_all | + map('extract', hostvars, 'mssql_ha_replica_type') | + list | + select('match', '^primary$') | + list + +- debug: + var: ansible_play_hosts_all | + map('extract', hostvars, 'mssql_ha_replica_type') | + select('match', '^primary$') | + list | + length == 1 + +- debug: + var: ansible_play_hosts_all | + map('extract', hostvars, 'mssql_ha_replica_type') | + list | + select('match', '^primary$') | + list | + length == 1 + - name: Verify that 'mssql_ha_replica_type = primary' is provided once assert: that: ansible_play_hosts_all | map('extract', hostvars, 'mssql_ha_replica_type') | select('match', '^primary$') | + list | length == 1 fail_msg: >- You must set the mssql_ha_replica_type variable to 'primary' for one of diff --git a/tests/tests_accept_eula_2019.yml b/tests/tests_accept_eula_2019.yml deleted file mode 100644 index 21c87562..00000000 --- a/tests/tests_accept_eula_2019.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role runs when EULA are accepted - hosts: all - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Verify the failure on a fresh host when required vars undefined - block: - - name: Run the role with default parameters - include_role: - name: linux-system-roles.mssql - - - name: Unreachable task - fail: - msg: The above task must fail - - rescue: - - name: Assert that the role failed with variables undefined - assert: - that: >- - 'You must define the following variables to set up MSSQL' in - ansible_failed_result.msg.0 diff --git a/tests/tests_default_2019.yml b/tests/tests_default_2019.yml deleted file mode 100644 index dcbb3778..00000000 --- a/tests/tests_default_2019.yml +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role runs with default parameters - hosts: all - tasks: - - name: Verify that by default the role fails with EULA not accepted - block: - - name: Run the role with default parameters - include_role: - name: linux-system-roles.mssql - - - name: Unreachable task - fail: - msg: The above task must fail - - rescue: - - name: Assert that the role failed with EULA not accepted - assert: - that: >- - 'You must accept EULA' in ansible_failed_result.msg.0 diff --git a/tests/tests_idempotency_2017.yml b/tests/tests_idempotency_2017.yml deleted file mode 100644 index e373b01f..00000000 --- a/tests/tests_idempotency_2017.yml +++ /dev/null @@ -1,99 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role is idempotent - hosts: all - gather_facts: false - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Run on a fresh host and set all parameters - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: 2017 - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - mssql_tcp_port: 1443 - mssql_ip_address: 0.0.0.0 - mssql_enable_sql_agent: true - mssql_install_fts: true - mssql_enable_ha: true - mssql_tune_for_fua_storage: true - - - name: Configure the mssql-server service start limit interval and burst - include_tasks: tasks/mssql-sever-increase-start-limit.yml - - - name: Flush handlers - meta: flush_handlers - - - name: Run again with the same settings - should report not changed - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: 2017 - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - mssql_tcp_port: 1443 - mssql_ip_address: 0.0.0.0 - mssql_enable_sql_agent: true - mssql_install_fts: true - mssql_enable_ha: true - mssql_tune_for_fua_storage: true - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD" - __verify_mssql_edition: Evaluation - __verify_mssql_tcp_port: 1443 - __verify_mssql_ip_address: 0.0.0.0 - __verify_mssql_agent_is_enabled: true - __verify_mssql_fts_is_installed: true - __verify_mssql_ha_is_installed: true - __verify_mssql_is_tuned_for_fua: true - - - name: Run to edit settings - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rd" - mssql_edition: Standard - mssql_tcp_port: 1442 - mssql_ip_address: 127.0.0.1 - mssql_enable_sql_agent: false - mssql_install_fts: false - mssql_enable_ha: false - mssql_tune_for_fua_storage: false - - - name: Flush handlers - meta: flush_handlers - - - name: Run with the edited settings again - should report not changed - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rd" - mssql_edition: Standard - mssql_tcp_port: 1442 - mssql_ip_address: 127.0.0.1 - mssql_enable_sql_agent: false - mssql_install_fts: false - mssql_enable_ha: false - mssql_tune_for_fua_storage: false - - - name: Verify disabled settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rd" - __verify_mssql_edition: Standard - __verify_mssql_tcp_port: 1442 - __verify_mssql_ip_address: 127.0.0.1 - __verify_mssql_agent_is_enabled: false - __verify_mssql_fts_is_installed: false - __verify_mssql_ha_is_installed: false - __verify_mssql_is_tuned_for_fua: false - - - name: Check the ansible_managed header in the configuration file - include_tasks: tasks/check_header.yml diff --git a/tests/tests_idempotency_2019.yml b/tests/tests_idempotency_2019.yml deleted file mode 100644 index b897240a..00000000 --- a/tests/tests_idempotency_2019.yml +++ /dev/null @@ -1,97 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role is idempotent - hosts: all - gather_facts: false - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Run on a fresh host and set all parameters - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - mssql_tcp_port: 1443 - mssql_ip_address: 0.0.0.0 - mssql_enable_sql_agent: true - mssql_install_fts: true - mssql_enable_ha: true - mssql_tune_for_fua_storage: true - - - name: Configure the mssql-server service start limit interval and burst - include_tasks: tasks/mssql-sever-increase-start-limit.yml - - - name: Flush handlers - meta: flush_handlers - - - name: Run again with the same settings - should report not changed - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - mssql_tcp_port: 1443 - mssql_ip_address: 0.0.0.0 - mssql_enable_sql_agent: true - mssql_install_fts: true - mssql_enable_ha: true - mssql_tune_for_fua_storage: true - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD" - __verify_mssql_edition: Evaluation - __verify_mssql_tcp_port: 1443 - __verify_mssql_ip_address: 0.0.0.0 - __verify_mssql_agent_is_enabled: true - __verify_mssql_fts_is_installed: true - __verify_mssql_ha_is_installed: true - __verify_mssql_is_tuned_for_fua: true - - - name: Run to edit settings - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rd" - mssql_edition: Standard - mssql_tcp_port: 1442 - mssql_ip_address: 127.0.0.1 - mssql_enable_sql_agent: false - mssql_install_fts: false - mssql_enable_ha: false - mssql_tune_for_fua_storage: false - - - name: Flush handlers - meta: flush_handlers - - - name: Run with the edited settings again - should report not changed - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rd" - mssql_edition: Standard - mssql_tcp_port: 1442 - mssql_ip_address: 127.0.0.1 - mssql_enable_sql_agent: false - mssql_install_fts: false - mssql_enable_ha: false - mssql_tune_for_fua_storage: false - - - name: Verify disabled settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rd" - __verify_mssql_edition: Standard - __verify_mssql_tcp_port: 1442 - __verify_mssql_ip_address: 127.0.0.1 - __verify_mssql_agent_is_enabled: false - __verify_mssql_fts_is_installed: false - __verify_mssql_ha_is_installed: false - __verify_mssql_is_tuned_for_fua: false - - - name: Check the ansible_managed header in the configuration file - include_tasks: tasks/check_header.yml diff --git a/tests/tests_include_vars_from_parent_2019.yml b/tests/tests_include_vars_from_parent_2019.yml deleted file mode 100644 index d64ab8cf..00000000 --- a/tests/tests_include_vars_from_parent_2019.yml +++ /dev/null @@ -1,47 +0,0 @@ -- hosts: all - tasks: - - name: create var file in caller that can override the one in called role - delegate_to: localhost - copy: - # usually the fake file will cause the called role to crash of - # overriding happens, but if not, set a variable that will - # allow to detect the bug - content: "__caller_override: true" - # XXX ugly, self-modifying code - changes the "caller" role on - # the controller - dest: "{{ playbook_dir }}/roles/caller/vars/{{ item }}.yml" - mode: preserve - loop: "{{ varfiles | unique }}" - # In case the playbook is executed against multiple hosts, use - # only the first one. Otherwise the hosts would stomp on each - # other since they are changing files on the controller. - when: inventory_hostname == ansible_play_hosts_all[0] - vars: - # change to hostvars['localhost']['ansible_facts'] to use the - # information for localhost - facts: "{{ ansible_facts }}" - versions: - - "{{ facts['distribution_version'] }}" - - "{{ facts['distribution_major_version'] }}" - separators: [ "-", "_" ] - # create all variants like CentOS, CentOS_8.1, CentOS-8.1, - # CentOS-8, CentOS-8.1 - # more formally: - # {{ ansible_distribution }}-{{ ansible_distribution_version }} - # {{ ansible_distribution }}-{{ ansible_distribution_major_version }} - # {{ ansible_distribution }} - # {{ ansible_os_family }} - # and the same for _ as separator. - varfiles: "{{ [facts['distribution']] | product(separators) | - map('join') | product(versions) | map('join') | list + - [facts['distribution'], facts['os_family']] }}" - - - import_role: - name: caller - vars: - roletoinclude: linux-system-roles.mssql - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - mssql_password: P@55w0rD - mssql_edition: Evaluation diff --git a/tests/tests_input_sql_file_2019.yml b/tests/tests_input_sql_file_2019.yml deleted file mode 100644 index bdf63c28..00000000 --- a/tests/tests_input_sql_file_2019.yml +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role can input sql files to MSSQL - hosts: all - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Set up MSSQL and input the sql file - include_role: - name: linux-system-roles.mssql - vars: - mssql_input_sql_file: sql_script.sql - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - - - name: Verify the failure when the mssql_password var is not specified - block: - - name: Input the sql file without the mssql_password variable - include_role: - name: linux-system-roles.mssql - vars: - mssql_input_sql_file: sql_script.sql - - - name: Unreachable task - fail: - msg: The above task must fail - - rescue: - - name: Assert that the role failed with mssql_password not defined - assert: - that: >- - 'You must define the mssql_password variable' in - ansible_failed_result.msg diff --git a/tests/tests_password_2017.yml b/tests/tests_password_2017.yml deleted file mode 100644 index b40e16ac..00000000 --- a/tests/tests_password_2017.yml +++ /dev/null @@ -1,91 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role is idempotent when changing the sa user password - hosts: all - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Set up MSSQL - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: 2017 - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - - - name: Configure the mssql-server service start limit interval and burst - include_tasks: tasks/mssql-sever-increase-start-limit.yml - - - name: Flush handlers - meta: flush_handlers - - - name: >- - Change the password with default settings. - Should report Changed. - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD11" - - - name: Flush handlers - meta: flush_handlers - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD11" - - - name: Change the IP address setting. - include_role: - name: linux-system-roles.mssql - vars: - mssql_ip_address: 127.0.0.1 - - - name: Flush handlers - meta: flush_handlers - - - name: >- - Change the password with a custom IP address. - Should report Changed. - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD" - - - name: Flush handlers - meta: flush_handlers - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD" - - - name: Change the TCP port setting. - include_role: - name: linux-system-roles.mssql - vars: - mssql_tcp_port: 1432 - - - name: Flush handlers - meta: flush_handlers - - - name: >- - Change the password with a custom TCP port and IP address. - Should report Changed. - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD11" - - - name: Flush handlers - meta: flush_handlers - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD11" - - - name: Check the ansible_managed header in the configuration file - include_tasks: tasks/check_header.yml diff --git a/tests/tests_password_2019.yml b/tests/tests_password_2019.yml deleted file mode 100644 index 9b5911ac..00000000 --- a/tests/tests_password_2019.yml +++ /dev/null @@ -1,90 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role is idempotent when changing the sa user password - hosts: all - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Set up MSSQL - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - - - name: Configure the mssql-server service start limit interval and burst - include_tasks: tasks/mssql-sever-increase-start-limit.yml - - - name: Flush handlers - meta: flush_handlers - - - name: >- - Change the password with default settings. - Should report Changed. - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD11" - - - name: Flush handlers - meta: flush_handlers - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD11" - - - name: Change the IP address setting. - include_role: - name: linux-system-roles.mssql - vars: - mssql_ip_address: 127.0.0.1 - - - name: Flush handlers - meta: flush_handlers - - - name: >- - Change the password with a custom IP address. - Should report Changed. - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD" - - - name: Flush handlers - meta: flush_handlers - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD" - - - name: Change the TCP port setting. - include_role: - name: linux-system-roles.mssql - vars: - mssql_tcp_port: 1432 - - - name: Flush handlers - meta: flush_handlers - - - name: >- - Change the password with a custom TCP port and IP address. - Should report Changed. - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD11" - - - name: Flush handlers - meta: flush_handlers - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD11" - - - name: Check the ansible_managed header in the configuration file - include_tasks: tasks/check_header.yml diff --git a/tests/tests_powershell_2019.yml b/tests/tests_powershell_2019.yml deleted file mode 100644 index 54bc2988..00000000 --- a/tests/tests_powershell_2019.yml +++ /dev/null @@ -1,63 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role install powershell in an idempotent manner - hosts: all - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Run on a fresh host and install powershell - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - mssql_install_powershell: true - - - name: Configure the mssql-server service start limit interval and burst - include_tasks: tasks/mssql-sever-increase-start-limit.yml - - - name: Flush handlers - meta: flush_handlers - - - name: Run again with the same settings - should report not changed - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - mssql_install_powershell: true - - - name: Verify settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD" - __verify_mssql_edition: Evaluation - __verify_mssql_powershell_is_installed: true - - - name: Run to edit settings - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rd" - mssql_edition: Standard - mssql_install_powershell: false - - - name: Flush handlers - meta: flush_handlers - - - name: Run with the edited settings again - should report not changed - include_role: - name: linux-system-roles.mssql - vars: - mssql_password: "p@55w0rd" - mssql_edition: Standard - mssql_install_powershell: false - - - name: Verify disabled settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rd" - __verify_mssql_edition: Standard - __verify_mssql_powershell_is_installed: false diff --git a/tests/tests_tls_2019.yml b/tests/tests_tls_2019.yml deleted file mode 100644 index 4c9c45b9..00000000 --- a/tests/tests_tls_2019.yml +++ /dev/null @@ -1,84 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that tls encryption configuration works - hosts: all - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: List installed RPMs on localhost to see if openssl is present - package_facts: - changed_when: no - delegate_to: localhost - - - name: Ensure the openssl package on localhost - package: - name: openssl - state: present - delegate_to: localhost - when: "'openssl' not in ansible_facts.packages" - - - name: >- - Generate a self-signed certificate and public key in the test directory - on localhost - command: >- - openssl req -x509 -nodes -newkey rsa:2048 - -subj "/CN={{ ansible_default_ipv4.address }}" - -keyout mssql.key -out mssql.pem -days 365 - changed_when: true - delegate_to: localhost - - - name: >- - Set up MSSQL and remove the certificate and public key on localhost. - Test relative and full path with cert and private_key vars. - block: - - name: Set up MSSQL - include_role: - name: linux-system-roles.mssql - public: true - vars: - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - mssql_tls_enable: true - mssql_tls_cert: "{{ playbook_dir }}/mssql.pem" - mssql_tls_private_key: mssql.key - mssql_tcp_port: 1433 - - always: - - name: Remove the certificate and public key on localhost - file: - path: "{{ item }}" - state: absent - delegate_to: localhost - loop: - - mssql.pem - - mssql.key - - - name: Flush handlers - meta: flush_handlers - - - name: Verify connectivity and settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD" - __verify_mssql_is_tls_encrypted: true - - - name: Disable TLS encryption - include_role: - name: linux-system-roles.mssql - public: true - vars: - mssql_tls_enable: false - - - name: Flush handlers - meta: flush_handlers - - - name: Verify connectivity and settings - include_tasks: tasks/verify_settings.yml - vars: - __verify_mssql_password: "p@55w0rD" - __verify_mssql_is_tls_encrypted: false - - - name: Check the ansible_managed header in the configuration file - include_tasks: tasks/check_header.yml diff --git a/tests/tests_upgrade_2017.yml b/tests/tests_upgrade_2017.yml deleted file mode 100644 index 3d38ff4e..00000000 --- a/tests/tests_upgrade_2017.yml +++ /dev/null @@ -1,93 +0,0 @@ -# SPDX-License-Identifier: MIT ---- -- name: Ensure that the role installs version 2017 and upgrades to 2019 - hosts: all - vars: - mssql_accept_microsoft_odbc_driver_17_for_sql_server_eula: true - mssql_accept_microsoft_cli_utilities_for_sql_server_eula: true - mssql_accept_microsoft_sql_server_standard_eula: true - tasks: - - name: Verify the failure when mssql_version is provided incorrectly - block: - - name: Run the role with incorrect mssql_version - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: 2018 - - - name: Unreachable task - fail: - msg: The above task must fail - - rescue: - - name: Assert that the role failed with the correct message - assert: - that: >- - 'The mssql_version variable must be set to either 2017 or 2019' in - ansible_failed_result.msg - - - name: Verify the failure when mssql_upgrade is provided with version 2017 - block: - - name: Run the role with mssql_version 2017 and mssql_upgrade true - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: 2017 - mssql_upgrade: true - - - name: Unreachable task - fail: - msg: The above task must fail - - rescue: - - name: Assert that the role failed with the correct message - assert: - that: >- - 'You set mssql_upgrade to true and mssql_version to 2017.' in - ansible_failed_result.msg.0 - - - name: Set up MSSQL 2017 - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: 2017 - mssql_password: "p@55w0rD" - mssql_edition: Evaluation - - - name: Upgrade to 2019 - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: 2019 - mssql_upgrade: yes - - - name: Upgrade again to test idempotency - should report not changed - include_role: - name: linux-system-roles.mssql - vars: - mssql_upgrade: true - mssql_version: 2019 - - - name: >- - Verify the failure when mssql_version is set to 2017 when SQL Server has - version 2019 - block: - - name: Run the role with mssql_version 2017 on SQL Server 2019 - include_role: - name: linux-system-roles.mssql - vars: - mssql_version: "2017" - - - name: Unreachable task - fail: - msg: The above task must fail - - rescue: - - name: Assert that the role failed with the correct message - assert: - that: >- - 'set mssql_version to 2017, but your SQL Server is version 2019.' - in ansible_failed_result.msg.0 - - - name: Check the ansible_managed header in the configuration file - include_tasks: tasks/check_header.yml