Skip to content

Commit

Permalink
added more quick default role tests icingadb_redis
Browse files Browse the repository at this point in the history
  • Loading branch information
mkayontour committed Jan 5, 2024
1 parent 5c976ce commit a586add
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 4 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/role-icingadb_redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
# These Jobs should be always be run against the latest version of ansible on the systems
# Feel free to update python and ansible versions
#
# In addition to keep them quick and no additional variables are used.
#
name: role-icingadb_redis
on:
push:
branches:
- main
- 'feature/**'
- 'fix/**'
- '!doc/**'
paths:
- roles/icingadb_redis/**
- molecule/role-icingadb_redis/**
pull_request:
branches:
- 'feature/**'
- 'fix/**'
- '!doc/**'

jobs:
icingadb_redis-ubuntu2204-latest:
runs-on: ubuntu-latest

env:
COLLECTION_NAMESPACE: icinga
COLLECTION_NAME: icinga

strategy:
fail-fast: false
max-parallel: 1
matrix:
distro: [ubuntu2204]
python: ['3.10']
ansible: ['2.16.2']
scenario: [role-icingadb_redis]

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install dependencies ansible
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-test-${{ matrix.ansible }}.txt
- name: Install collection
run: |
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
- name: Test with molecule
run: |
ansible --version
molecule --version
molecule test -s ${{ matrix.scenario }}
env:
MOLECULE_DISTRO: ${{ matrix.distro }}
11 changes: 7 additions & 4 deletions .github/workflows/role-icingaweb2.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
name: Empty role-icingaweb2
# These Jobs should be always be run against the latest version of ansible on the systems
# Feel free to update python and ansible versions
#
# In addition to keep them quick and no additional variables are used.
#
name: role-icingaweb2
on:
push:
tags:
- '*'
branches:
- main
- 'feature/**'
Expand All @@ -19,7 +22,7 @@ on:
- '!doc/**'

jobs:
icingaweb2-ansible-latest:
icingaweb2-ubuntu2204-latest:
runs-on: ubuntu-latest

env:
Expand Down
5 changes: 5 additions & 0 deletions molecule/role-icingadb_redis/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
collections:
- name: community.mysql
- name: community.docker
- name: community.general
version: ">=2,<3"
12 changes: 12 additions & 0 deletions molecule/role-icingadb_redis/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

- name: Converge
hosts: all
collections:
- icinga.icinga
pre_tasks:
- ansible.builtin.include_role:
name: repos
post_tasks:
- ansible.builtin.include_role:
name: icingadb_redis
4 changes: 4 additions & 0 deletions molecule/role-icingadb_redis/dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependency:
name: galaxy
options:
role-file: requirements.yml
Empty file.
26 changes: 26 additions & 0 deletions molecule/role-icingadb_redis/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: icingadb_redis-default
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
inventory:
link:
host_vars: host_vars/
verifier:
name: testinfra
directory: tests/integration/
lint: |
set -e
yamllint --no-warnings roles/
ansible-lint roles/
11 changes: 11 additions & 0 deletions molecule/role-icingadb_redis/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Prepare
hosts: all
tasks:
- name: Install requirements for Debian
apt:
name:
- gpg
- apt-transport-https
update_cache: yes
when: ansible_os_family == "Debian"
2 changes: 2 additions & 0 deletions molecule/role-icingadb_redis/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
roles:
- geerlingguy.mysql
9 changes: 9 additions & 0 deletions molecule/role-icingadb_redis/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

- name: Verify
hosts: all
tasks:
- name: Check for running icinga2
service:
name: icinga2
state: started

0 comments on commit a586add

Please sign in to comment.