-
Notifications
You must be signed in to change notification settings - Fork 60
/
preflight.yml
39 lines (35 loc) · 1.31 KB
/
preflight.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- 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"
- 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
- 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"