Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add role hifis.zammad #196

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 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
10 changes: 10 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
MIT License

Copyright (c) 2020 Helmholtz Centre for Environmental Research (UFZ)
Copyright (c) 2020 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)

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.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ 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

This collection provides production-ready Ansible roles used for providing services used in research and by research
software engineers, but not exclusively. The following use cases are supported:
* DevOps platform

* DevOps platform:
* GitLab (coming soon!)
* 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 All @@ -33,6 +35,7 @@ software engineers, but not exclusively. The following use cases are supported:
* Ansible >= 2.14

## Installation

Install the collection via ansible-galaxy:

```shell
Expand Down
2 changes: 2 additions & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ authors:
- 'HIFIS Software Services <support@hifis.net>'
description: 'This collection provides production-ready Ansible roles used for providing services used in research and by research software engineers, but not exclusively.'
license:
- 'Apache-2.0'
- 'GPL-2.0-or-later'
- 'MIT'
tags:
- 'hifis'
- 'ubuntu'
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: Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 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: Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 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: Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 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: Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 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: Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: 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: Helmholtz Centre for Environmental Research (UFZ)
# SPDX-FileCopyrightText: Helmholtz-Zentrum Dresden-Rossendorf (HZDR)
#
# SPDX-License-Identifier: Apache-2.0

---

collections:
- name: "community.crypto"
Loading