{"id":4454,"sha1":"5a2cebac00fc6df31b3153603770d3c6f0cafcd6","playbook":{"id":2378,"items":{"plays":1,"tasks":4,"results":1167,"hosts":297,"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/bash-kvm-inventory-prod.sh"],"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":"2024-12-16T15:01:49.954871Z","ended":"2024-12-16T15:05:04.044551Z","duration":"00:03:14.089680","name":null,"ansible_version":"2.16.11","client_version":"1.7.2","python_version":"3.10.10","server_version":"1.7.2","status":"failed","path":"/home/ssh-gateway/ansible/kuly/agent360_check_version.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Check if there is a need to upgrade agent360\n  hosts: all\n  gather_facts: false\n  vars:\n    latest_version: \"\"\n  tasks:\n    - name: Get the latest version of agent360 from GitHub\n      ansible.builtin.shell: |\n        latest=$(curl -sL https://api.github.com/repos/plesk/agent360/releases/latest | jq -r \".tag_name\" | sed 's/^v//')\n        echo $latest\n      register: latest_version_out\n      changed_when: false\n\n    - name: Set the latest_version variable\n      set_fact:\n        latest_version: \"{{ latest_version_out.stdout }}\"\n\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 need updating\n      when: ver_out.rc == 0 and ver_out.stdout < 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 }} need upgrade - version {{ ver_out.stdout }}'\n      delegate_to: localhost\n","created":"2024-12-16T15:01:49.972377Z","updated":"2024-12-16T15:01:49.972396Z","path":"/home/ssh-gateway/ansible/kuly/agent360_check_version.yaml"}