Skip to content

Commit 451496a

Browse files
authored
Merge pull request #3 from NUZAT-TABASSUM/dev
Enable automatic linting/molecule tests and Debian support (relates to #1,#2 )
2 parents aca4bf5 + 980d5b0 commit 451496a

File tree

15 files changed

+353
-34
lines changed

15 files changed

+353
-34
lines changed

.ansible-lint

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# .ansible-lint
3+
exclude_paths:
4+
- .cache/
5+
- .github/
6+
- venv/
7+
- .ansible/

.dev_requirements.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ansible
2+
ansible-core>=2.11
3+
ansible-lint
4+
dnspython
5+
yamllint
6+
molecule
7+
molecule-plugins
8+
molecule-plugins[docker]
9+
molecule-plugins[podman]

.github/workflows/lint.yml

Lines changed: 21 additions & 0 deletions
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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
3+
name: molecule
4+
5+
on: # yamllint disable-line rule:truthy
6+
- push
7+
- pull_request
8+
9+
jobs:
10+
molecule:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install dependencies
17+
run: pip3 install -r .dev_requirements.txt
18+
19+
- name: Test playbook
20+
run: molecule test -- -e opencast_postgresql_password=123
21+
env:
22+
PY_COLORS: '1'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv/
2+
.ansible/

.yamllint

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
# Yamllint configuration should be compatible with Ansible,
3+
# see https://ansible.readthedocs.io/projects/lint/rules/yaml/#yamllint-configuration
4+
5+
extends: default
6+
7+
rules:
8+
comments:
9+
# https://github.com/prettier/prettier/issues/6780
10+
min-spaces-from-content: 1
11+
# https://github.com/adrienverge/yamllint/issues/384
12+
comments-indentation: false
13+
document-start: disable
14+
# 160 chars was the default used by old E204 rule, but
15+
# you can easily change it or disable in your .yamllint file.
16+
line-length:
17+
max: 200
18+
# We are adding an extra space inside braces as that's how prettier does it
19+
# and we are trying not to fight other linters.
20+
braces:
21+
min-spaces-inside: 0 # yamllint defaults to 0
22+
max-spaces-inside: 1 # yamllint defaults to 0
23+
# key-duplicates:
24+
# forbid-duplicated-merge-keys: true # not enabled by default
25+
octal-values:
26+
forbid-implicit-octal: true # yamllint defaults to false
27+
forbid-explicit-octal: true # yamllint defaults to false
28+
# quoted-strings:
29+
# quote-type: double
30+
# required: only-when-needed
31+
32+
33+
ignore: |
34+
.cache/
35+
.github/
36+
venv/

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
opencast_postgresql_version: 12
3+
opencast_postgresql_version: 16
44
opencast_postgresql_user: opencast
55
opencast_postgresql_database: opencast
66
opencast_postgresql_connection_hosts:

handlers/main.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
---
2-
- name: restart postgresql
3-
service:
4-
name: postgresql
5-
state: restarted
2+
- name: Restart Postgresql On CentOS
3+
ansible.builtin.service:
4+
name: "postgresql-{{ opencast_postgresql_version }}"
5+
state: restarted
6+
when: ansible_os_family == "RedHat"
7+
8+
- name: Restart Postgresql On Debian/Ubuntu
9+
ansible.builtin.service:
10+
name: postgresql
11+
state: restarted
12+
when: ansible_os_family == "Debian"

meta/main.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1+
---
12
galaxy_info:
23
author: Lars Kiesow
34
role_name: opencast_postgresql
45
namespace: elan
56
company: ELAN e.V.
67
description: Install and prepare PostgreSQL for Opencast
78
license: BSD-3-Clause
8-
min_ansible_version: 2.9
9+
min_ansible_version: "2.9"
10+
911
galaxy_tags:
1012
- opencast
13+
1114
platforms:
1215
- name: EL
1316
versions:
14-
- 8
17+
- "8"
18+
- "9"
19+
- name: Debian
20+
versions:
21+
- "bullseye"
22+
- "bookworm"
23+
- name: Ubuntu
24+
versions:
25+
- "focal"
26+
- "jammy"
27+
- "noble"
1528

1629
dependencies: []

molecule/default/Dockerfile.j2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM {{ item.image }}
2+
3+
# Install dependencies
4+
{% if "centos" in item.name %}
5+
RUN dnf install --refresh -y sudo systemd bash ca-certificates iproute pam passwd shadow-utils python39 python3-libselinux
6+
{% else %}
7+
RUN apt-get update && apt-get install -y sudo init bash ca-certificates iproute2 python3 && apt-get clean
8+
{% endif %}

0 commit comments

Comments
 (0)