{"id":5170,"sha1":"9976786e1b0f6e5f73c7767e262cfb4cff0514d9","playbook":{"id":3050,"items":{"plays":2,"tasks":4,"results":22,"hosts":11,"files":1,"records":0},"arguments":{"version":null,"verbosity":2,"private_key_file":"/home/ssh-gateway/.ssh/id_rsa","remote_user":"root","connection":"ssh","timeout":null,"ssh_common_args":null,"sftp_extra_args":null,"scp_extra_args":null,"ssh_extra_args":null,"ask_pass":false,"connection_password_file":null,"force_handlers":false,"flush_cache":false,"become":false,"become_method":"sudo","become_user":null,"become_ask_pass":false,"become_password_file":null,"tags":["all"],"skip_tags":[],"check":false,"diff":false,"inventory":["/home/ssh-gateway/ansible/kuly/canary-inventory"],"listhosts":false,"subset":null,"extra_vars":"Not saved by ARA as configured by 'ignored_arguments'","vault_ids":[],"ask_vault_pass":false,"vault_password_files":[],"forks":20,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["agent360_check_version.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"}],"started":"2025-05-28T10:35:23.801055+01:00","ended":"2025-05-28T10:35:28.631363+01:00","duration":"00:00:04.830308","name":null,"ansible_version":"2.16.11","client_version":"1.7.2","python_version":"3.10.10","server_version":"1.7.2","status":"completed","path":"/home/ssh-gateway/ansible/kuly/agent360_check_version.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Get latest agent360 version from GitHub\n  hosts: localhost\n  gather_facts: false\n  strategy: linear\n  vars:\n    # Fallback version if GitHub fails\n    latest_version: \"1.3.3\"\n  tasks:\n    - name: Get the latest version of agent360 from GitHub\n      ansible.builtin.shell: |\n        set -o pipefail\n        latest=$(curl -sL https://api.github.com/repos/plesk/agent360/releases/latest  | jq -r \".tag_name\" | sed 's/^v//')\n        echo \"$latest\"\n      args:\n        executable: /bin/bash\n      register: latest_version_out\n      changed_when: false\n      run_once: true\n\n    - name: Set the latest_version fact globally\n      ansible.builtin.set_fact:\n        latest_version: \"{{ latest_version_out.stdout }}\"\n      run_once: true\n\n- name: Check if each host needs agent360 upgrade\n  hosts: all\n  gather_facts: false\n  strategy: linear\n  tasks:\n    - name: Get installed version and compare\n      ansible.builtin.shell: |\n        set -o pipefail\n        pip$(head -1 $(which agent360) | awk -F \"python\" '{print $2}') show agent360 | grep Version | awk '{ print $2 }'\n      args:\n        executable: /bin/bash\n      register: ver_out\n      changed_when: ver_out.rc != 0\n\n    - name: Log the ones needing an upgrade\n      when: ver_out.rc == 0 and ver_out.stdout < hostvars['localhost']['latest_version']\n      ansible.builtin.lineinfile:\n        path: /home/ssh-gateway/ansible/kuly/agent360_need_upgrade.txt\n        create: true\n        mode: '0644'\n        line: '{{ inventory_hostname }} needs upgrade - version {{ ver_out.stdout }}'\n      delegate_to: localhost\n","created":"2025-05-28T10:35:23.816759+01:00","updated":"2025-05-28T10:35:23.816781+01:00","path":"/home/ssh-gateway/ansible/kuly/agent360_check_version.yaml"}