2023-03-03 09:53:02 +01:00
|
|
|
---
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Get Grafana Agent version from Github
|
2023-03-03 09:53:02 +01:00
|
|
|
when: grafana_agent_version == 'latest' and not __grafana_agent_local_install
|
|
|
|
block:
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Get the latest published Grafana Agent # noqa command-instead-of-module
|
2023-03-03 09:53:02 +01:00
|
|
|
ansible.builtin.shell: |
|
|
|
|
curl -s https://api.github.com/repos/{{ _grafana_agent_github_org }}/{{ _grafana_agent_github_repo }}/releases/latest \
|
|
|
|
| grep -m 1 tag_name \
|
|
|
|
| cut -d '"' -f 4 | cut -c 2-
|
|
|
|
changed_when: false
|
|
|
|
run_once: true
|
|
|
|
delegate_to: localhost
|
|
|
|
become: false
|
|
|
|
register: _grafana_agent_version_request
|
|
|
|
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Set the Grafana Agent version
|
2023-03-03 09:53:02 +01:00
|
|
|
ansible.builtin.set_fact:
|
|
|
|
grafana_agent_version: "{{ _grafana_agent_version_request.stdout }}"
|
|
|
|
|
2023-04-18 12:27:54 +02:00
|
|
|
- name: Grafana Agent version to download
|
2023-03-03 09:53:02 +01:00
|
|
|
ansible.builtin.debug:
|
|
|
|
var: grafana_agent_version
|
|
|
|
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Set the Grafana Agent download URL
|
2023-03-03 09:53:02 +01:00
|
|
|
ansible.builtin.set_fact:
|
|
|
|
_grafana_agent_download_url: |-
|
|
|
|
{{ _grafana_agent_base_download_url }}/v{{ grafana_agent_version }}/{{ _grafana_agent_download_archive_file }}
|
|
|
|
|
2023-03-10 06:45:00 +01:00
|
|
|
- name: Grafana Agent download URL
|
2023-03-03 09:53:02 +01:00
|
|
|
ansible.builtin.debug:
|
|
|
|
var: _grafana_agent_download_url
|