fix: avoid using shell for fetching latest version (#55)

Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
gardar 2023-05-17 05:17:24 +00:00 committed by GitHub
parent 2e81758100
commit a817b1a8ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,21 +1,9 @@
--- ---
- name: Get Grafana Agent version from Github - name: Set the Grafana Agent version to latest version
when: grafana_agent_version == 'latest' and not __grafana_agent_local_install
block:
- name: Get the latest published Grafana Agent # noqa command-instead-of-module
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
- name: Set the Grafana Agent version
ansible.builtin.set_fact: ansible.builtin.set_fact:
grafana_agent_version: "{{ _grafana_agent_version_request.stdout }}" grafana_agent_version: "{{ (lookup('url', 'https://api.github.com/repos/{{ _grafana_agent_github_org }}/{{ _grafana_agent_github_repo }}/releases/latest',
split_lines=False) | from_json).get('tag_name') | replace('v', '') }}"
when: grafana_agent_version == 'latest' and not __grafana_agent_local_install
- name: Grafana Agent version to download - name: Grafana Agent version to download
ansible.builtin.debug: ansible.builtin.debug: