Execution
Date 27 Nov 2025 16:15:23 +0000
Duration 00:00:00.42
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
0 Hosts
1 Tasks
0 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/zz-vik-364.yaml

---
- name: Playbook to get kcare version
  hosts: all
  gather_facts: false
  tasks:
    - name: Get kcare version
      ansible.builtin.shell: |
        set -o pipefail
        rpm -q --qf '%{VERSION}\n' kernelcare
      args:
        executable: /bin/bash
      changed_when: false
      register: q_res
    - name: Extract the major version
      ansible.builtin.set_fact:
        major_version: "{{ q_res.stdout.split('.')[0] | int }}"
    - name: Debug int
      ansible.builtin.debug:
        msg: "Major version is: {{ major_version }}"
    - name: Show debug when version 2
      ansible.builtin.debug:
        msg: "Kernelcare major version 2 detected on: {{ inventory_hostname }}"
      when: major_version == "2"
    - name: Save the version
      ansible.builtin.lineinfile:
        path: "/home/ssh-gateway/ansible/kuly/zz-vik-364-{{ type }}.txt"
        create: true
        mode: '0644'
        line: "{{ inventory_hostname }} - {{ q_res.stdout }}"
      delegate_to: 127.0.0.1
      when: major_version == "2"