Execution
Date 22 Jul 2025 16:19:00 +0100
Duration 00:00:02.28
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
1 Hosts
3 Tasks
3 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/repair_imunify.yaml

---
- name: Repair Imunify
  hosts: all
  gather_facts: false

  tasks:
    - name: Get Plesk info
      plesk_info:
      register: pl

    - name: Check Imunify license and trigger repair if invalid
      # Use debug for reporting, and set changed_when appropriately
      debug:
        msg: "Imunify license is not valid (status: {{ pl.imunify_license_status }}), triggering repair..."
      when: pl.plesk_found and pl.imunify_found and pl.imunify_license_valid == false
      changed_when: true

    - name: Run Imunify repair command
      command: /usr/bin/imunify360-repair --license
      args:
        warn: false  # Avoid warning about using command
      when: pl.plesk_found and pl.imunify_found and pl.imunify_license_valid == false
      register: repair_result
      changed_when: "'Nothing to repair' not in repair_result.stdout"
      # Optionally, you can fail if repair fails
      failed_when: repair_result.rc != 0 and 'Nothing to repair' not in repair_result.stdout

    - name: Confirm repair result
      debug:
        var: repair_result
      when: repair_result is defined