Execution
Date 15 Sep 2025 17:13:33 +0100
Duration 00:00:00.56
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.3 / 1.7.3
Python 3.10.10
Summary
1 Hosts
1 Tasks
1 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/zz-kvm_patching_workflow.yml

---
- name: Conditional KVM Host Health Check
  hosts: all
  gather_facts: false

  tasks:
    - name: Check if system needs restarting
      kvm_upgrade_utils:
        action: check_restart
      register: restart_status

    - name: Check for available updates
      kvm_upgrade_utils:
        action: check_updates
      register: update_status

    - name: Validate system resources
      kvm_upgrade_utils:
        action: validate_resources
        min_available_ram_mb: 2048
      register: resource_status

    - name: Display critical system issues
      ansible.builtin.debug:
        msg: |
          {% set issues = [] %}
          {% if restart_status.needs_restarting %}{% set _ = issues.append("RESTART REQUIRED ⚠️") %}{% endif %}
          {% if update_status.updates_available %}{% set _ = issues.append(update_status.update_count ~ " updates available 📦") %}{% endif %}
          {% if not resource_status.resource_status.sufficient_memory %}{% set _ = issues.append("LOW MEMORY ⚠️") %}{% endif %}
          
          {% if issues %}
          ❌ {{ inventory_hostname }}: {{ issues | join(', ') }}
          {% else %}
          ✅ {{ inventory_hostname }}: All good
          {% endif %}