From aa13c166e2f5e4fc615a455fe7ce75e023486fab Mon Sep 17 00:00:00 2001 From: Fatih Sarhan Date: Fri, 12 Jul 2024 23:20:50 +0300 Subject: [PATCH] alloy: Restart the service when version changed Co-authored-by: YunusEMRE <53182424+emre-23@users.noreply.github.com> Co-authored-by: acciorg <52622368+acciorg@users.noreply.github.com> --- roles/alloy/tasks/install.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/alloy/tasks/install.yml b/roles/alloy/tasks/install.yml index b78a9532..9af3d8e0 100644 --- a/roles/alloy/tasks/install.yml +++ b/roles/alloy/tasks/install.yml @@ -24,19 +24,19 @@ dest: "/tmp/alloy-{{ version }}.zip" mode: '0755' become: true - register: download_result - -- name: Remove existing alloy binary - ansible.builtin.file: - path: "{{ installation_dir }}/alloy-linux-{{ arch }}" - state: absent - become: true - when: download_result.changed - name: Extract alloy binary ansible.builtin.unarchive: src: "/tmp/alloy-{{ version }}.zip" - dest: "{{ installation_dir }}" + dest: "/tmp" + remote_src: yes + become: true + +- name: Copy installed binary to installation dir + ansible.builtin.copy: + src: "/tmp/alloy-linux-{{ arch }}" + dest: "{{ installation_dir }}/alloy-linux-{{ arch }}" + mode: '0755' remote_src: yes become: true - register: extract_result + notify: Restart alloy