ansible-loki-role/tasks/preflight.yml

41 lines
1.1 KiB
YAML
Raw Normal View History

2020-04-19 22:28:06 +02:00
---
2020-04-22 00:54:44 +02:00
- name: Assert usage of systemd as an init system
2023-05-20 15:28:15 +02:00
ansible.builtin.assert:
2020-04-22 00:54:44 +02:00
that: ansible_service_mgr == 'systemd'
msg: "This module only works with systemd"
2020-04-19 22:28:06 +02:00
2023-05-20 15:28:15 +02:00
- name: Get version
when:
- loki_version == "latest"
- loki_binary_local_dir | length == 0
block:
2020-04-19 22:28:06 +02:00
- name: Get latest release
2023-05-20 15:28:15 +02:00
ansible.builtin.uri:
2020-04-19 22:28:06 +02:00
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
2020-04-22 00:54:44 +02:00
- name: Set loki version to {{ _latest_release.json.tag_name[1:] }}
2023-05-20 15:28:15 +02:00
ansible.builtin.set_fact:
2020-04-19 22:28:06 +02:00
loki_version: "{{ _latest_release.json.tag_name[1:] }}"
2023-05-20 15:28:15 +02:00
2021-12-17 17:32:05 +01:00
- name: Install unzip
2023-05-20 15:28:15 +02:00
ansible.builtin.apt:
2021-12-17 17:32:05 +01:00
name: unzip
2021-12-17 17:43:52 +01:00
update_cache: true
- name: Install dnspython
2023-05-20 15:28:15 +02:00
ansible.builtin.pip:
2022-03-04 14:43:35 +01:00
name:
2022-02-04 13:54:05 +01:00
- dnspython
2022-03-04 14:43:35 +01:00
- docker