Execution
Date 16 Dec 2024 13:57:17 +0000
Duration 00:00:01.99
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
2 Tasks
2 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
  vars:
    latest_version: 1.3.1
  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: Show if different
      when: ver_out.rc = 0 and ver_out.stdout < "latest_version"
      ansible.builtin.debug:
        msg: Needs upgrading