---
- name: upgrade safenode-manager to a new version
  hosts: all
  become: False
  max_fail_percentage: 10
  ignore_unreachable: yes
  vars:
    node_manager_archive_filename: safenode-manager-{{ version }}-x86_64-unknown-linux-musl.tar.gz
    node_manager_archive_url: https://sn-node-manager.s3.eu-west-2.amazonaws.com/{{ node_manager_archive_filename }}
  tasks:
    - name: download the node manager binary
      ansible.builtin.get_url:
        url: "{{ node_manager_archive_url }}"
        dest: /tmp/{{ node_manager_archive_filename }}
    - name: extract the node manager binary to /usr/local/bin
      become: True
      ansible.builtin.unarchive:
        src: "/tmp/{{ node_manager_archive_filename }}"
        dest: "/usr/local/bin"
        remote_src: True
