44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
---
|
|
- name: Assert usage of systemd as an init system
|
|
assert:
|
|
that: ansible_service_mgr == 'systemd'
|
|
msg: "This module only works with systemd"
|
|
|
|
- block:
|
|
- name: Get latest release
|
|
uri:
|
|
url: "https://api.github.com/repos/grafana/loki/releases/latest"
|
|
method: GET
|
|
return_content: True
|
|
status_code: 200
|
|
body_format: json
|
|
validate_certs: False
|
|
user: "{{ lookup('env', 'GH_USER') | default(omit) }}"
|
|
password: "{{ lookup('env', 'GH_TOKEN') | default(omit) }}"
|
|
no_log: "{{ not lookup('env', 'ANSIBLE_DEBUG') | bool }}"
|
|
register: _latest_release
|
|
until: _latest_release.status == 200
|
|
retries: 5
|
|
|
|
- name: "Set promtail version to {{ _latest_release.json.tag_name[1:] }}"
|
|
set_fact:
|
|
promtail_version: "{{ _latest_release.json.tag_name[1:] }}"
|
|
when:
|
|
- promtail_version == "latest"
|
|
delegate_to: localhost
|
|
run_once: True
|
|
|
|
|
|
- name: "Get checksum list"
|
|
set_fact:
|
|
__promtail_checksums: "{{ lookup('url', 'https://github.com/grafana/loki/releases/download/v' + promtail_version + '/SHA256SUMS', wantlist=True) | list }}"
|
|
run_once: True
|
|
delegate_to: localhost
|
|
|
|
- name: "Get checksum for {{ go_arch }} architecture"
|
|
set_fact:
|
|
__promtail_checksum: "{{ item.split(' ')[0] }}"
|
|
with_items: "{{ __promtail_checksums }}"
|
|
when:
|
|
- "('promtail-linux-' + go_arch + '.zip') in item"
|