# SPDX-License-Identifier: MIT
---
- name: Test the role with default params
  hosts: all

  pre_tasks:
    - name: Save state of services
      import_tasks: get_services_state.yml

  tasks:
    - name: Run test
      block:
        - name: Include role
          include_role:
            name: fedora.linux_system_roles.metrics
            public: true

        - name: Flush handlers
          meta: flush_handlers

      rescue:
        - name: Handle failure case
          include_tasks: handle_test_failure.yml

      always:
        - name: Restore state of services
          import_tasks: restore_services_state.yml
