add karma role and fix lint errors

This commit is contained in:
Sergey Malyuk
2025-12-16 13:42:21 +03:00
parent e5d56718b6
commit dd24220532
22 changed files with 346 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
---
- name: Converge
hosts: all
gather_facts: true
become: true
roles:
- role: genlab.common.karma
karma_version: "0.121"
config_source_dir: molecule/default/

View File

@@ -0,0 +1,17 @@
alertmanager:
interval: 1m
servers:
- name: production
uri: http://localhost:9093
timeout: 20s
proxy: false
readonly: true
listen:
address: "0.0.0.0"
port: 8080
prefix: /
tls:
cert: ""
key: ""
cors:
allowedOrigins: []

View File

@@ -0,0 +1,27 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2404}-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,35 @@
---
- name: Verify
hosts: all
gather_facts: false
any_errors_fatal: true
vars:
karma_version: "0.121"
tasks:
- name: "Check if Karma is installed"
changed_when: false
ansible.builtin.command: "karma --version"
register: karma_installed_version
- name: "Check Karma version"
ansible.builtin.assert:
that: "karma_installed_version.stdout is regex('{{ karma_version }}')"
success_msg: "Karma version {{ karma_version }} is installed and working"
fail_msg: "Karma version {{ karma_version }} is not installed or not working correctly"
# kics-scan ignore-block
- name: "Check if Karma is reachable"
ansible.builtin.uri:
url: "http://localhost:8080/health"
return_content: true
status_code: 200
method: GET
body_format: json
register: karma_health
- name: "Assert Karma health status"
ansible.builtin.assert:
that: "karma_health.content.strip() == 'Pong'"
success_msg: "Karma is healthy"
fail_msg: "Karma is not healthy"