Skip to content

Commit ba550ed

Browse files
committed
Molecule tests
1 parent a58bd93 commit ba550ed

File tree

8 files changed

+78
-38
lines changed

8 files changed

+78
-38
lines changed

.dev_requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
ansible
2+
ansible-core>=2.13.9
23
ansible-lint
34
yamllint
45
molecule
6+
molecule-plugins
7+
molecule-plugins[docker]
8+
molecule-plugins[podman]

.github/workflows/lint.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: lint
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
pull_request:
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: install dependencies
16+
run: >
17+
pip install -r .dev_requirements.txt
18+
19+
- run: yamllint --strict -c .yamllint .
20+
21+
- run: ansible-lint

.github/workflows/molecule.yml

+4-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
32
name: molecule
43

54
on: # yamllint disable-line rule:truthy
@@ -9,36 +8,14 @@ on: # yamllint disable-line rule:truthy
98
jobs:
109
molecule:
1110
runs-on: ubuntu-latest
12-
strategy:
13-
fail-fast: false
14-
matrix:
15-
os:
16-
- dist: centos
17-
release: 8-Stream
18-
- dist: centos
19-
release: 9-Stream
20-
- dist: debian
21-
release: buster
22-
- dist: debian
23-
release: bullseye
24-
- dist: ubuntu
25-
release: focal
26-
- dist: ubuntu
27-
release: jammy
2811

2912
steps:
30-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
3114

3215
- name: install dependencies
33-
run: pip3 install -r .dev_requirements.txt
34-
35-
- name: create lxc container
36-
uses: lkiesow/setup-lxc-container@v1
37-
with:
38-
dist: ${{ matrix.os.dist }}
39-
release: ${{ matrix.os.release }}
16+
run: pip install -r .dev_requirements.txt
4017

41-
- name: run molecule tests
18+
- name: test playbook
19+
run: molecule test
4220
env:
4321
PY_COLORS: '1'
44-
run: molecule test

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Ansible Role to Install MariaDB for Opencast
22

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

56
Install MariaDB for [Opencast](https://opencast.org/) with [ansible](https://docs.ansible.com/).

meta/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ galaxy_info:
66
description: Install MariaDB for Opencast.
77
company: virtUOS
88
license: BSD-3-Clause
9-
min_ansible_version: "2.09"
9+
min_ansible_version: "2.13.9"
1010
platforms:
1111
- name: EL
1212
versions:
@@ -20,4 +20,5 @@ galaxy_info:
2020
versions:
2121
- focal
2222
- jammy
23+
- noble
2324
dependencies: []

molecule/default/Dockerfile.j2

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM {{ item.image }}
2+
3+
# Install dependencies
4+
{% if "el" in item.name %}
5+
RUN dnf install --refresh -y systemd
6+
{% else %}
7+
RUN apt-get update && apt-get install -y ca-certificates gpg init python3 && apt-get clean
8+
{% endif %}

molecule/default/converge.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
- name: Converge
33
hosts: all
4-
become: true
54
vars:
65
database_password: "1234"
76
database_root_password: "5678"

molecule/default/molecule.yml

+38-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,47 @@
11
---
2+
driver:
3+
name: containers
24
dependency:
35
name: galaxy
4-
driver:
5-
name: delegated
6-
options:
7-
managed: false
8-
login_cmd_template: ssh {instance}
9-
ansible_connection_options:
10-
ansible_connection: ssh
6+
enabled: false
117
platforms:
12-
- name: test
8+
- name: opencast_mariadb_el9
9+
image: quay.io/centos/centos:stream9
10+
pre_build_image: false
11+
command: /sbin/init
12+
tmpfs:
13+
"/tmp": "exec"
14+
"/run": "rw,noexec,nosuid,nodev"
15+
volumes:
16+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
17+
published_ports:
18+
- 3306/tcp
19+
- name: opencast_mariadb_debian
20+
image: docker.io/debian:stable
21+
pre_build_image: false
22+
command: /sbin/init
23+
tmpfs:
24+
"/tmp": "exec"
25+
"/run": "rw,noexec,nosuid,nodev"
26+
volumes:
27+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
28+
published_ports:
29+
- 3306/tcp
30+
- name: opencast_mariadb_ubuntu
31+
image: docker.io/ubuntu:latest
32+
pre_build_image: false
33+
command: /sbin/init
34+
tmpfs:
35+
"/tmp": "exec"
36+
"/run": "rw,noexec,nosuid,nodev"
37+
volumes:
38+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
39+
published_ports:
40+
- 3306/tcp
1341
lint: |
14-
ansible-lint
42+
set -e
1543
yamllint -c .yamllint .
44+
ansible-lint
1645
provisioner:
1746
name: ansible
1847
verifier:

0 commit comments

Comments
 (0)