# SPDX-License-Identifier: MIT
---
- name: Test qnetd setup with qnetd not starting on boot
  hosts: all
  vars_files: vars/main.yml
  vars:
    ha_cluster_cluster_present: false
    ha_cluster_qnetd:
      present: true
      start_on_boot: false
  tasks:
    - name: Run test
      tags:
        - tests::booted
        - tests::verify
      block:
        - name: Skip test in bootc mode
          include_tasks: tasks/skip_if_bootc.yml

        - name: Set up test environment
          include_role:
            name: linux-system-roles.ha_cluster
            tasks_from: test_setup.yml

        - name: Clean up test environment for qnetd / qdevice
          include_role:
            name: linux-system-roles.ha_cluster
            tasks_from: test_cleanup_qnetd.yml

        - name: Run HA Cluster role
          include_role:
            name: linux-system-roles.ha_cluster

        - name: Get services status
          service_facts:

        - name: Check services status
          assert:
            that:
              - ansible_facts.services["corosync-qnetd.service"].status
                == "disabled"
              - ansible_facts.services["corosync-qnetd.service"].state
                 == "running"
