grafana / grafana-ansible-collection

grafana.grafana Ansible collection provides modules and roles for managing various resources on Grafana Cloud and roles to manage and deploy Grafana Agent and Grafana
https://docs.ansible.com/ansible/latest/collections/grafana/grafana/index.html#plugins-in-grafana-grafana
GNU General Public License v3.0
113 stars 74 forks source link

alloy: Restart the service when version is changed #233

Open f9n opened 1 month ago

f9n commented 1 month ago

When we change the version (1.0.0 -> 1.2.0), role does not restart the alloy service. Is this normal? Or can we support restarting when version changes?

# roles/alloy/tasks/install.yml
...
- name: Download alloy binary
  ansible.builtin.get_url:
    url: "{{ binary_url }}"
    dest: "/tmp/alloy-{{ version }}.zip"
    mode: '0755'
  become: true

- name: Extract alloy binary
  ansible.builtin.unarchive:
    src: "/tmp/alloy-{{ version }}.zip"
    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
  notify: Restart alloy

If it is convenient for you, we can create a pull request for the above changes. cc: @emre-23 @acciorg

ishanjainn commented 1 month ago

Yeah, Ideally Alloy should be restarted when we have a version change.

Lemme know if you wanna fix this in a PR