# SPDX-License-Identifier: MIT
---
- name: Set platform/version specific variables
  ansible.builtin.include_tasks: set_vars.yml

- name: Check if role is supported on current architecture
  fail:
    msg: >-
      The role is not supported on architecture
      {{ ansible_facts["architecture"] }}
  when: ansible_facts["architecture"] in ["aarch64"]

- name: Install required packages
  ansible.builtin.include_tasks: install-packages.yml

- name: Check for an active stonith resource
  ansible.builtin.command:
    argv:
      - pcs
      - stonith
      - status
  register: stonith_status
  run_once: true
  changed_when: false
  failed_when:
    - stonith_status.rc != 0 or "Started" not in stonith_status.stdout
  when: not _gfs2_test_allow_stonith_disabled

- name: Setup cluster
  ansible.builtin.include_tasks: setup-cluster.yml
  when: gfs2_file_systems | length > 0
