add loki role and fix linter errors
This commit is contained in:
5
roles/loki/molecule/default/converge.yml
Normal file
5
roles/loki/molecule/default/converge.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
roles:
|
||||
- role: genlab.common.loki
|
||||
22
roles/loki/molecule/default/molecule.yml
Normal file
22
roles/loki/molecule/default/molecule.yml
Normal 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 .
|
||||
33
roles/loki/molecule/default/verify.yml
Normal file
33
roles/loki/molecule/default/verify.yml
Normal 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"
|
||||
Reference in New Issue
Block a user