# SPDX-License-Identifier: MIT
---
- name: Deconfigure cluster
  hosts: all
  vars:
    ha_cluster_cluster_present: false

  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: Run HA Cluster role
          include_role:
            name: linux-system-roles.ha_cluster
            public: true

        - name: Stat corosync.conf
          stat:
            path: /etc/corosync/corosync.conf
          register: stat_corosync_conf

        - name: Stat cib.xml
          stat:
            path: /var/lib/pacemaker/cib/cib.xml
          register: stat_cib_xml

        - name: Stat fence_xvm.key
          stat:
            path: /etc/cluster/fence_xvm.key
          register: stat_fence_xvm_key

        - name: Check the files do not exist
          assert:
            that:
              - not stat_corosync_conf.stat.exists
              - not stat_cib_xml.stat.exists
              - not stat_fence_xvm_key.stat.exists
