Skip to content

Commit

Permalink
added test for icingaweb2 role with defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
mkayontour committed Jan 5, 2024
1 parent 0bba33d commit 5c976ce
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/role-icingaweb2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: Empty role-icingaweb2
on:
push:
tags:
- '*'
branches:
- main
- 'feature/**'
- 'fix/**'
- '!doc/**'
paths:
- roles/icingaweb2/**
- molecule/role-icingaweb2/**
pull_request:
branches:
- 'feature/**'
- 'fix/**'
- '!doc/**'

jobs:
icingaweb2-ansible-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-icingaweb2]

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 }}
5 changes: 5 additions & 0 deletions molecule/role-icingaweb2/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-icingaweb2/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: icingaweb2
4 changes: 4 additions & 0 deletions molecule/role-icingaweb2/dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependency:
name: galaxy
options:
role-file: requirements.yml
14 changes: 14 additions & 0 deletions molecule/role-icingaweb2/files/test.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Business Process Config File ###
#
# Title : test
# Description : test
# Owner : icinga
# AddToMenu : yes
# Statetype : soft
#
###################################

test2 =
display 1;test2;test2
webserver =
display 1;webserver;webserver
Empty file.
26 changes: 26 additions & 0 deletions molecule/role-icingaweb2/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: icinga-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-icingaweb2/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-icingaweb2/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-icingaweb2/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
5 changes: 5 additions & 0 deletions requirements-test-2.16.2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ansible-core==2.16.2
ansible-lint
molecule
molecule-docker
pytest-testinfra

0 comments on commit 5c976ce

Please sign in to comment.