38 lines
1.1 KiB
YAML
38 lines
1.1 KiB
YAML
---
|
|
- name: Assert usage of systemd as an init system
|
|
ansible.builtin.assert:
|
|
that: ansible_service_mgr == 'systemd'
|
|
msg: "This module only works with systemd"
|
|
|
|
- name: Get version
|
|
when:
|
|
- loki_version == "latest"
|
|
- loki_binary_local_dir | length == 0
|
|
block:
|
|
- name: Get latest release
|
|
ansible.builtin.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 loki version to {{ _latest_release.json.tag_name[1:] }}
|
|
ansible.builtin.set_fact:
|
|
loki_version: "{{ _latest_release.json.tag_name[1:] }}"
|
|
|
|
- name: Install deps
|
|
ansible.builtin.apt:
|
|
name:
|
|
- unzip
|
|
- python3-dnspython
|
|
- python3-docker
|
|
update_cache: true
|