# SPDX-License-Identifier: MIT
---
- name: Maximal SBD configuration (inventory)
  hosts: all
  vars_files: vars/main.yml

  tasks:
    - name: Run test
      tags: tests::verify
      block:
        - name: Set up test environment
          include_role:
            name: linux-system-roles.ha_cluster
            tasks_from: test_setup.yml

        - name: Set up test environment for SBD
          include_role:
            name: linux-system-roles.ha_cluster
            tasks_from: test_setup_sbd.yml
          vars:
            __test_disable_modprobe: true  # noqa: var-naming[no-role-prefix]

        # Generate an "inventory" variable for each node.
        - name: Set SBD devices and watchdogs
          set_fact:
            ha_cluster:
              sbd_watchdog_modules:
                - softdog
              sbd_watchdog_modules_blocklist:
                - iTCO_wdt
              sbd_watchdog: /dev/null
              sbd_devices:
                - "{{ __test_sbd_mount.stdout }}"

        - name: Run the role and assert results
          include_tasks: template_sbd_all_options.yml

      always:
        - name: Unset SBD devices and watchdogs
          set_fact:
            ha_cluster:

        - name: Clean up test environment for SBD
          include_role:
            name: linux-system-roles.ha_cluster
            tasks_from: test_cleanup_sbd.yml
