Execution
Date 18 Mar 2024 12:08:23 +0000
Duration 00:00:00.17
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.2.dev2
Python 3.10.10
Summary
0 Hosts
0 Tasks
0 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/check-kcare.yaml

---
- name: Check if kcare.service is present and running
  hosts: your_target_hosts
  gather_facts: true

  tasks:
    - name: Check if kcare.service exists
      stat:
        path: /usr/lib/systemd/system/kcare.service
      register: kcare_service

    - name: Check if kcare.service is running
      command: systemctl is-active kcare.service
      register: kcare_service_status
      ignore_errors: true

    - name: Display status message
      debug:
        msg: |
          kcare.service status:
          Exists: {{ kcare_service.stat.exists | default(false) }}
          Running: {{ kcare_service_status.stdout | default('Unknown') }}