# SPDX-License-Identifier: MIT
---
- name: Ensure mandatory variables are defined
  hosts: all
  gather_facts: false
  tasks:
    - name: Run test
      tags: tests::verify
      block:
        - name: Run the role
          include_role:
            name: redhat.rhel_system_roles.ha_cluster
      rescue:
        - name: Extract errors
          set_fact:
            error_list: "{{ ansible_failed_result.results | map(attribute='msg') | list }}"
          run_once: true # noqa: run_once[task]

        - name: Check errors
          assert:
            that:
              - "'ha_cluster_hacluster_password must be specified' in error_list"
