Execution
Date 28 May 2025 10:15:22 +0100
Duration 00:00:13.34
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
0 Hosts
1 Tasks
0 Results
1 Plays
1 Files
0 Records

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

---
- name: Check if there is a need to upgrade agent360
  hosts: all
  gather_facts: false
  pre_tasks:
    - name: Include task to get and set latest version
      ansible.builtin.include_tasks: agent360_get_latest_version.yml
  tasks:
    - name: Get installed version and compare
      ansible.builtin.shell: |
        set -o pipefail
        pip$(head -1  $(which agent360)| awk -F "python" '{print $2}') show agent360 | grep Version | awk '{ print $2 }'
      args:
        executable: /bin/bash
      register: ver_out
      changed_when: ver_out.rc != 0

    - name: Log the ones need updating
      when: ver_out.rc == 0 and ver_out.stdout < latest_version
      ansible.builtin.lineinfile:
        path: /home/ssh-gateway/ansible/kuly/agent360_need_upgrade.txt
        create: true
        mode: '0644'
        line: '{{ inventory_hostname }} need upgrade - version {{ ver_out.stdout }}'
      delegate_to: localhost