Skip to content

Commit

Permalink
Debian plattform support and Molecule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmirnow committed Jul 26, 2024
1 parent c8e4918 commit 43c2371
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 67 deletions.
5 changes: 5 additions & 0 deletions .dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
ansible
ansible-core>=2.13.9
ansible-lint
yamllint
molecule
molecule-plugins
molecule-plugins[docker]
molecule-plugins[podman]
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---

name: Ansible lint
name: lint

on: # yamllint disable-line rule:truthy
push:
Expand All @@ -15,10 +14,8 @@ jobs:

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

- run: yamllint --strict .
- run: ansible-lint
24 changes: 24 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: molecule

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

jobs:
molecule:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: install Ansbile dependencies
run: ansible-galaxy install -r requirements.yml

- name: test playbook
run: molecule test
env:
PY_COLORS: '1'
45 changes: 0 additions & 45 deletions .github/workflows/test.yml

This file was deleted.

1 change: 0 additions & 1 deletion .test/roles/elan.opencast_opensearch

This file was deleted.

9 changes: 0 additions & 9 deletions .test/test.yml

This file was deleted.

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Ansible: Opencast OpenSearch Role
====================================

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

This Ansible role installs and prepares OpenSearch for Opencast.

This role supports the following,

- Supports RHEL9
- Supports RHEL9, Debian and Ubuntu
- Install and configure OpenSearch from `elan.opencast_repository`
- Disables the OpenSearch security plugin completely. Use a reverse
proxy to secure OpenSearch with HTTP Basic Auth and TLS.
Expand All @@ -25,7 +28,7 @@ This role supports the following,

## Dependencies

This role requires `elan.opencast_repository`.
This role depends on `elan.opencast_repository`.

## Example Playbook

Expand All @@ -35,7 +38,6 @@ Example of how to configure and use the role:
- hosts: servers
become: true
roles:
- role: elan.opencast_repository
- role: elan.opencast_opensearch
```
Expand Down
12 changes: 11 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ galaxy_info:
min_ansible_version: "2.9"
galaxy_tags:
- opencast
- opensearch
platforms:
- name: EL
versions:
- "9"
dependencies: []
- name: Debian
versions:
- bookworm
- name: Ubuntu
versions:
- focal
- jammy
- noble
dependencies:
- role: elan.opencast_repository
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 | lower) %}
RUN dnf install --refresh -y systemd
{% else %}
RUN apt-get update && apt-get install -y ca-certificates gpg init python3 && apt-get clean
{% endif %}
11 changes: 11 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Converge
hosts: all
vars:
opencast_version_major: 15
opencast_repository_enabled_release: true
opencast_opensearch_heap_size: 100m
tasks:
- name: Include opensearch role
ansible.builtin.include_role:
name: "opencast_opensearch"
52 changes: 52 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
driver:
name: containers
dependency:
name: galaxy
enabled: false
platforms:
# GH Action for EL8 fails
# - name: el8
# image: quay.io/rockylinux/rockylinux:8
# pre_build_image: false
# command: /sbin/init
# tmpfs:
# "/tmp": "exec"
# "/run": "rw,noexec,nosuid,nodev"
# volumes:
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: opensearch_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
- name: opensearch_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
- name: opensearch_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
lint: |
set -e
yamllint -c .yamllint .
ansible-lint
provisioner:
name: ansible
verifier:
name: ansible
14 changes: 14 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Stat Opensearch configuration directory
ansible.builtin.stat:
path: /etc/opensearch
register: os_conf_dir

- name: Test Opensearch configuration directory exists
ansible.builtin.assert:
that: os_conf_dir.stat.exists
4 changes: 4 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

roles:
- name: elan.opencast_repository
10 changes: 9 additions & 1 deletion tasks/opensearch.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
---
- name: OpenSearch Install | Install via package manager
- name: OpenSearch Install on Debian
ansible.builtin.apt:
name: opensearch
state: present
update_cache: true
when: ansible_os_family == 'Debian'

- name: OpenSearch Install on EL
ansible.builtin.dnf:
name: opensearch
state: present
enablerepo: "{{ opencast_repository_identifiers }}"
update_cache: true
when: ansible_os_family == 'RedHat'

- name: OpenSearch Install | Copy Configuration File
notify: Restart opensearch
Expand Down

0 comments on commit 43c2371

Please sign in to comment.