add loki role and fix linter errors

This commit is contained in:
Sergey Malyuk
2025-12-16 16:16:43 +03:00
parent b52350deb4
commit 236bd1ff72
20 changed files with 433 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: genlab.common.loki

View File

@@ -0,0 +1,22 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-ubuntu2204-ansible:latest
pre_build_image: true
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .

View File

@@ -0,0 +1,33 @@
---
- name: Verify
hosts: all
gather_facts: false
any_errors_fatal: true
tasks:
# https://github.com/ansible/molecule/issues/3587#issuecomment-1158650179
- name: "Include default vars"
ansible.builtin.include_vars:
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults/"
extensions: ['yml']
- name: "Sanity check the Loki daemon"
retries: 5
delay: 1
register: loki_this
failed_when: "loki_version not in loki_this.content"
ansible.builtin.uri:
url: "http://localhost:{{ loki_port }}/metrics"
return_content: true
- name: "Ensure that locgli is installed and able to run"
register: loki_logcli
failed_when: loki_logcli.rc != 0
changed_when: false
ansible.builtin.command:
cmd: logcli --version
- name: "Check logcli version"
ansible.builtin.assert:
that: "'version {{ loki_version }}' in loki_logcli.stderr"
success_msg: "logcli version {{ loki_version }} is installed and working"
fail_msg: "logcli version {{ loki_version }} is not installed or not working correctly"