Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add molecule tests to collection #42

Merged
merged 25 commits into from
Jul 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b8064e5
Add molecule tests to collection
widhalmt May 25, 2021
6151a60
As a first step try to install Icinga 2
widhalmt May 25, 2021
c436c11
Try other path for collections
widhalmt May 25, 2021
ababfda
Try to place collection into default path
widhalmt May 25, 2021
5a17683
Copy collection to default path but run test from pwd
widhalmt May 25, 2021
bca3a6e
Try without prefix
widhalmt May 25, 2021
1c22bc7
Clean up comments
widhalmt May 25, 2021
f22f7be
Add `icinga2` role to test runs
widhalmt May 25, 2021
fe45993
Re-enable setting of collection path
widhalmt May 25, 2021
02c122a
Add CentOS 8 and Debian 9 to tests
widhalmt May 25, 2021
c4330e7
Restrict tests to CentOS 7 to save ressources
widhalmt May 25, 2021
a0c139c
Fix collection path to undocumented variant
widhalmt May 25, 2021
7a61c0d
Trying with even more forked up path
widhalmt May 25, 2021
741f7ac
Finally add meaningful tests
widhalmt May 25, 2021
461277b
Remove CentOS 8 from tests because molecule doesn't seem to work
widhalmt May 25, 2021
162dff3
Fix typo
widhalmt May 25, 2021
d065f3a
Fix typo
widhalmt May 25, 2021
7bd6732
Cleanup and remove extra test
widhalmt May 25, 2021
01ee75d
Remove Debian 9 because it seems to be broken
widhalmt May 25, 2021
504db72
removed comments in galaxy.yml
mkayontour May 31, 2021
675194f
Changed multiline yaml syntax
mkayontour May 31, 2021
82df090
remove trailing spaces
mkayontour May 31, 2021
aa6527d
Update galaxy.yml
mkayontour May 31, 2021
60102e9
Delete INSTALL.rst
widhalmt Jun 8, 2021
1aa2b75
Change URL of badge as requested by @mkayontour
widhalmt Jun 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skip_list:
- 'yaml'
48 changes: 48 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: CI
on:
push:
tags:
- v*
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest

env:
COLLECTION_NAMESPACE: icinga
COLLECTION_NAME: icinga

strategy:
# max-parallel: 4
matrix:
distro: [centos7, centos8, debian10]
scenario: [default]

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

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-test.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: |
molecule test -s ${{ matrix.scenario }}
env:
MOLECULE_DISTRO: ${{ matrix.distro }}
2 changes: 2 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
extends: relaxed
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ansible-collection-icinga

[![CI](https://github.com/Icinga/ansible-collection-icinga/workflows/CI/badge.svg?event=push)](https://github.com/Icinga/ansible-collection-icinga/actions/workflows/molecule.yml/badge.svg)

Collection to setup and manage components of the Icinga software stack.

## Roles
Expand Down
57 changes: 10 additions & 47 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,21 @@
### REQUIRED

# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: icinga

# The name of the collection. Has the same character restrictions as 'namespace'
name: icinga

# The version of the collection. Must be compatible with semantic versioning
version: 0.1.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- Lennart Betz <lennart.betz@netways.de>
- Thilo Wening <thilo.wening@netways.de>


### OPTIONAL but strongly recommended

# A short summary description of the collection
description: your collection description

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
- Thomas Widhalm <thomas.widhalm@netways.de>
description: >
This collection manages all Icinga 2 Components.
Including the official repositories, server, satellite and agent installations.
Furthermore it can easily create and distribute monitoring configuration.
license:
- GPL-3.0-or-later

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: 'LICENSE'

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: []

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
tags: [ 'icinga2','monitoring','icingaweb2','agent','master','server','satellite']
dependencies: {}

# The URL of the originating SCM repository
repository: http://example.com/repository

# The URL to any online docs
documentation: http://docs.example.com

# The URL to the homepage of the collection/project
homepage: http://example.com

# The URL to the collection issue tracker
issues: http://example.com/issue/tracker
repository: https://github.com/Icinga/ansible-collection-icinga
documentation: https://github.com/Icinga/ansible-collection-icinga/tree/main/doc
homepage: http://icinga.com
issues: https://github.com/Icinga/ansible-collection-icinga/issues
13 changes: 13 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

- name: Converge
hosts: all
collections:
icinga.icinga
tasks:
- name: "Include Icinga Repos"
include_role:
name: repos
- name: "Include Icinga 2"
include_role:
name: icinga2
21 changes: 21 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: icinga-default
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .
10 changes: 10 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Prepare
hosts: all
tasks:
- name: Install requirements for Debian
package:
name:
- gpg
- apt-transport-https
when: ansible_os_family == "Debian"
9 changes: 9 additions & 0 deletions molecule/default/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
4 changes: 4 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ansible
ansible-lint
molecule
molecule-docker
2 changes: 1 addition & 1 deletion roles/icinga2/tasks/features/idomysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
loop: "{{ icinga2_dict_features.idomysql |dict2items }}"
loop_control:
loop_var: idx

- name: feature idomysql IdoMysqlConnection object
icinga2_object:
name: ido-mysql
Expand Down
2 changes: 1 addition & 1 deletion roles/icinga2/tasks/features/idopgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
loop: "{{ icinga2_dict_features.idopgsql |dict2items }}"
loop_control:
loop_var: idx

- name: feature idopgsql IdoPgsqlConnection object
icinga2_object:
name: ido-pgsql
Expand Down
2 changes: 1 addition & 1 deletion roles/icinga2/tasks/features/syslog.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---

- name: feature syslog SyslogLogger object
icinga2_object:
name: syslog
Expand Down
2 changes: 1 addition & 1 deletion roles/repos/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
# handlers file for icinga_repos
# handlers file for icinga_repos
1 change: 0 additions & 1 deletion roles/repos/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ galaxy_info:
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.