Skip to content

Commit

Permalink
Merge zammad role into collection
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
  • Loading branch information
Norman Ziegner authored and Normo committed May 6, 2024
1 parent 893b995 commit 96346fa
Show file tree
Hide file tree
Showing 23 changed files with 860 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ unattended_upgrades:
- "roles/unattended_upgrades/**"
- "molecule/unattended_upgrades/**"
- ".github/workflows/unattended_upgrades.yml"
zammad:
- changed-files:
- any-glob-to-any-file:
- "roles/zammad/**"
- "molecule/zammad/**"
- ".github/workflows/zammad.yml"
78 changes: 78 additions & 0 deletions .github/workflows/zammad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SPDX-FileCopyrightText: 2022 Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 2022 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: Apache-2.0

---
name: "hifis.zammad"
on:
pull_request:
paths:
- '.github/workflows/zammad.yml'
- 'roles/zammad/**'
- 'molecule/zammad/**'
- 'Pipfile'
- 'Pipfile.lock'
push:
branches:
- "main"
tags:
- "v*.*.*"
paths:
- '.github/workflows/zammad.yml'
- 'roles/zammad/**'
- 'molecule/zammad/**'
- 'Pipfile'
- 'Pipfile.lock'
schedule:
- cron: '0 0 * * *'

jobs:

test:
name: "Run Molecule tests."
runs-on: "ubuntu-22.04"
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
strategy:
fail-fast: false
matrix:
image:
- "ghcr.io/hifis-net/ubuntu-systemd:22.04"
- "ghcr.io/hifis-net/ubuntu-systemd:20.04"

steps:
- name: "Check out the codebase."
uses: "actions/checkout@v4"
with:
path: "ansible_collections/hifis/software_services"

- name: "Prepare the job environment."
uses: "./ansible_collections/hifis/software_services/.github/workflows/prepare-action"

# https://github.com/ansible/molecule/issues/3806
- name: "Help molecule to find the dependencies"
run: |
mkdir -p /home/runner/.ansible
ln -s /home/runner/work/ansible-role-unattended-upgrades/ansible-role-unattended-upgrades/ansible_collections/hifis/software_services/roles \
/home/runner/.ansible/roles
- name: "Install modern podman"
run: |
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key \
| gpg --dearmor \
| sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
sudo apt-get update -qq
sudo apt-get -qq -y install podman
- name: "Run Molecule tests."
run: "XDG_RUNTIME_DIR=/run/user/$UID pipenv run molecule test -s zammad"
env:
MOLECULE_IMAGE: "${{ matrix.image }}"
working-directory: "ansible_collections/hifis/software_services"
2 changes: 1 addition & 1 deletion .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rules:
max-spaces-after: -1
level: "error"
comments: "disable"
comments-indentation: "enable"
comments-indentation: "disable"
document-start: "disable"
empty-lines:
max: 3
Expand Down
9 changes: 9 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SPDX-License-Identifier: Apache-2.0

[![Latest release](https://img.shields.io/github/v/release/hifis-net/ansible-role-unattended-upgrades)](https://github.com/hifis-net/ansible-role-unattended-upgrades/releases)
[![hifis.unattended_upgrades](https://github.com/hifis-net/ansible-role-unattended-upgrades/actions/workflows/unattended_upgrades.yml/badge.svg)](https://github.com/hifis-net/ansible-role-unattended-upgrades/actions/workflows/unattended_upgrades.yml)
[![hifis.zammad](https://github.com/hifis-net/ansible-role-unattended-upgrades/actions/workflows/zammad.yml/badge.svg)](https://github.com/hifis-net/ansible-role-unattended-upgrades/actions/workflows/zammad.yml)

## Description

Expand All @@ -19,7 +20,7 @@ software engineers, but not exclusively. The following use cases are supported:
* GitLab-Runner (coming soon!)
* Redis (coming soon!)
* Help desk:
* Zammad (coming soon!)
* [**Zammad**](roles/zammad)
* High Availability (HA) / Load Balancing:
* HAProxy (coming soon!)
* Keepalived (coming soon!)
Expand Down
30 changes: 30 additions & 0 deletions molecule/zammad/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2020 Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 2023 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: MIT

---
- name: "Converge"
hosts: "all"
tasks:

- name: "Get private key content"
ansible.builtin.command: "cat /etc/ssl/private/ssl-cert-snakeoil.key"
changed_when: false
check_mode: false
register: "private_key"

- name: "Get SSL certificate content"
ansible.builtin.command: "cat /etc/ssl/certs/ssl-cert-snakeoil.pem"
changed_when: false
check_mode: false
register: "certificate"

- name: "Pass SSL key pair to zammad role"
ansible.builtin.set_fact:
zammad_ssl_key: "{{ private_key.stdout }}"
zammad_ssl_cert: "{{ certificate.stdout }}"

- name: "Include ansible-role-zammad"
ansible.builtin.include_role:
name: "hifis.software_services.zammad"
30 changes: 30 additions & 0 deletions molecule/zammad/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2020 Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 2023 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: MIT

---
dependency:
name: "galaxy"
options:
requirements-file: "molecule/zammad/requirements.yml"
driver:
name: "podman"
platforms:
- name: "instance"
image: "${MOLECULE_IMAGE:-ghcr.io/hifis-net/ubuntu-systemd:22.04}"
pre_build_image: true
privileged: true
override_command: false
systemd: true
tty: true
published_ports:
- "0.0.0.0:8080:80"
- "0.0.0.0:8443:443"
provisioner:
name: "ansible"
playbooks:
prepare: "prepare.yml"
converge: "converge.yml"
verifier:
name: "ansible"
41 changes: 41 additions & 0 deletions molecule/zammad/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: 2020 Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 2023 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: MIT

---
- name: "Prepare"
hosts: "all"
vars:
# Apply suggested Elasticsearch configuration
elasticsearch_version: "8.x"
elasticsearch_package: "elasticsearch=8.8.1"
elasticsearch_heap_size_min: "256m"
elasticsearch_heap_size_max: "256m"
elasticsearch_extra_options: |
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
http.max_content_length: 400mb
indices.query.bool.max_clause_count: 2000
tasks:

- name: "Install required packages"
ansible.builtin.apt:
name:
- "sudo"
- "gpg"
- "ca-certificates"
- "python3-cryptography"
- "ssl-cert"
state: "present"
update_cache: true

- name: "Include geerlingguy.elasticsearch"
ansible.builtin.include_role:
name: "geerlingguy.elasticsearch"

- name: "Include geerlingguy.postgresql"
ansible.builtin.include_role:
name: "geerlingguy.postgresql"
17 changes: 17 additions & 0 deletions molecule/zammad/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2020 Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 2020 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: MIT

---

collections:
- name: "community.crypto"
version: "2.14.1" # Required due to https://github.com/ansible-collections/community.crypto/issues/627

roles:
- src: "geerlingguy.elasticsearch"
version: "5.1.2"

- src: "geerlingguy.postgresql"
version: "3.5.0"
16 changes: 16 additions & 0 deletions molecule/zammad/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: 2020 Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 2023 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: MIT

---
- name: "Verify"
hosts: "all"
tasks:
- name: "Check that Zammad web interface is available"
ansible.builtin.uri:
url: "https://localhost"
validate_certs: false
return_content: true
register: "zammad_web"
failed_when: "'Zammad Helpdesk' not in zammad_web.content"
9 changes: 9 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2024 Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 2024 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: Apache-2.0

---

collections:
- name: "community.crypto"
Loading

0 comments on commit 96346fa

Please sign in to comment.