Skip to content

Commit

Permalink
Molecule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmirnow committed Jul 30, 2024
1 parent a58bd93 commit ba550ed
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
ansible
ansible-core>=2.13.9
ansible-lint
yamllint
molecule
molecule-plugins
molecule-plugins[docker]
molecule-plugins[podman]
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: lint

on: # yamllint disable-line rule:truthy
push:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: install dependencies
run: >
pip install -r .dev_requirements.txt
- run: yamllint --strict -c .yamllint .

- run: ansible-lint
31 changes: 4 additions & 27 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

name: molecule

on: # yamllint disable-line rule:truthy
Expand All @@ -9,36 +8,14 @@ on: # yamllint disable-line rule:truthy
jobs:
molecule:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- dist: centos
release: 8-Stream
- dist: centos
release: 9-Stream
- dist: debian
release: buster
- dist: debian
release: bullseye
- dist: ubuntu
release: focal
- dist: ubuntu
release: jammy

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: install dependencies
run: pip3 install -r .dev_requirements.txt

- name: create lxc container
uses: lkiesow/setup-lxc-container@v1
with:
dist: ${{ matrix.os.dist }}
release: ${{ matrix.os.release }}
run: pip install -r .dev_requirements.txt

- name: run molecule tests
- name: test playbook
run: molecule test
env:
PY_COLORS: '1'
run: molecule test
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Ansible Role to Install MariaDB for Opencast

![lint](https://github.com/elan-ev/opencast_mariadb/actions/workflows/lint.yml/badge.svg)
![molecule](https://github.com/elan-ev/opencast_mariadb/actions/workflows/molecule.yml/badge.svg)

Install MariaDB for [Opencast](https://opencast.org/) with [ansible](https://docs.ansible.com/).
Expand Down
3 changes: 2 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ galaxy_info:
description: Install MariaDB for Opencast.
company: virtUOS
license: BSD-3-Clause
min_ansible_version: "2.09"
min_ansible_version: "2.13.9"
platforms:
- name: EL
versions:
Expand All @@ -20,4 +20,5 @@ galaxy_info:
versions:
- focal
- jammy
- noble
dependencies: []
8 changes: 8 additions & 0 deletions molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM {{ item.image }}

# Install dependencies
{% if "el" in item.name %}
RUN dnf install --refresh -y systemd
{% else %}
RUN apt-get update && apt-get install -y ca-certificates gpg init python3 && apt-get clean
{% endif %}
1 change: 0 additions & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
- name: Converge
hosts: all
become: true
vars:
database_password: "1234"
database_root_password: "5678"
Expand Down
47 changes: 38 additions & 9 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
---
driver:
name: containers
dependency:
name: galaxy
driver:
name: delegated
options:
managed: false
login_cmd_template: ssh {instance}
ansible_connection_options:
ansible_connection: ssh
enabled: false
platforms:
- name: test
- name: opencast_mariadb_el9
image: quay.io/centos/centos:stream9
pre_build_image: false
command: /sbin/init
tmpfs:
"/tmp": "exec"
"/run": "rw,noexec,nosuid,nodev"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
published_ports:
- 3306/tcp
- name: opencast_mariadb_debian
image: docker.io/debian:stable
pre_build_image: false
command: /sbin/init
tmpfs:
"/tmp": "exec"
"/run": "rw,noexec,nosuid,nodev"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
published_ports:
- 3306/tcp

Check failure on line 29 in molecule/default/molecule.yml

View workflow job for this annotation

GitHub Actions / lint

29:5 [indentation] wrong indentation: expected 6 but found 4
- name: opencast_mariadb_ubuntu
image: docker.io/ubuntu:latest
pre_build_image: false
command: /sbin/init
tmpfs:
"/tmp": "exec"
"/run": "rw,noexec,nosuid,nodev"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
published_ports:
- 3306/tcp
lint: |
ansible-lint
set -e
yamllint -c .yamllint .
ansible-lint
provisioner:
name: ansible
verifier:
Expand Down

0 comments on commit ba550ed

Please sign in to comment.