Execution
Date 25 Sep 2024 12:45:13 +0100
Duration 00:02:15.69
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.2 / 1.7.2
Python 3.10.10
Summary
165 Hosts
7 Tasks
1143 Results
1 Plays
11 Files
0 Records

File: /home/ssh-gateway/ansible/roles/imunify360/tasks/main.yml

---
# tasks file for imunify360-agent
- name: Check if imunify360-agent binary exists
  ansible.builtin.stat:
    path: /usr/bin/imunify360-agent
  register: imunify_binary

- name: Handle case when imunify360-agent binary does not exist
  ansible.builtin.set_fact:
    imunify_found: false
  when: not imunify_binary.stat.exists

- name: Run imunify360-agent health command and capture the output
  ansible.builtin.shell: |
    set -o pipefail
    /usr/bin/imunify360-agent health
  args:
    executable: /bin/bash
  register: imunify_health_out
  when: imunify_binary.stat.exists
  changed_when: false

- name: Check if 'OK' is in the imunify360-agent health output
  ansible.builtin.set_fact:
    imunify_found: "{{ 'OK' in imunify_health_out.stdout }}"
  when: imunify_binary.stat.exists

# - name: Run imunify360-agent health with --json flag and capture output
#  ansible.builtin.shell: |
#    set -o pipefail
#    /usr/bin/imunify360-agent health --json
#  args:
#    executable: /bin/bash
# register: imunify_health_json
#  when: imunify_binary.stat.exists and imunify_found
#  changed_when: false