Compare commits

...

2 commits

Author SHA1 Message Date
cbe9cd6946 etherpad systemd 2022-02-18 12:30:46 +01:00
6c4c271b7a start koha roles 2022-01-13 00:52:13 +01:00
8 changed files with 155 additions and 90 deletions

8
koha.yml Normal file
View file

@ -0,0 +1,8 @@
---
## KOHA
- name: Koha
hosts: localhost
roles: ['stable/common', 'koha']
vars_files: vars/koha.yml
tags: koha

84
roles/koha/tasks/main.yml Normal file
View file

@ -0,0 +1,84 @@
---
## Based on
## https://wiki.koha-community.org/wiki/Debian
- name: Add an Apt signing key, will not download if present
become: yes
apt_key:
url: https://debian.koha-community.org/koha/gpg.asc
state: present
keyring: /usr/share/keyrings/koha-community-archive-keyring.gpg
- name: Add Koha package repository
become: yes
apt_repository:
filename: koha.list
repo: "deb [signed-by=/usr/share/keyrings/koha-community-archive-keyring.gpg] http://debian.koha-community.org/koha stable main"
update_cache: yes
- name: Install koha and mariadb
become: yes
apt:
pkg:
- koha-common
- mariadb-server
- name: Configure the defaults
become: yes
template:
src: koha-sites.conf.j2
dest: /etc/koha/koha-sites.conf
- name: Enable the Apache2 module rewrite
become: yes
apache2_module:
state: present
name: rewrite
- name: Enable the Apache2 module cgi
become: yes
apache2_module:
state: present
name: cgi
- name: Make sure apache2 is restarted
become: yes
systemd:
state: restarted
name: apache2
- name: Create koha instance
become: yes
command:
cmd: koha-create --create-db "{{library_name}}"
- name: Enable the Apache2 module cgi
become: yes
apache2_module:
state: present
name: headers
- name: Enable the Apache2 module cgi
become: yes
apache2_module:
state: present
name: proxy_http
- name: Enable plack
become: yes
command:
cmd: koha-plack --enable "{{library_name}}"
- name: Start plack
become: yes
command:
cmd: koha-plack --start "{{library_name}}"
- name: Make sure apache2 is restarted
become: yes
systemd:
state: restarted
name: apache2

View file

@ -0,0 +1,52 @@
# NOTE: for a complete list of valid options please read koha-create(8)
## Apache virtual hosts creation variables
#
# Please note that the URLs are built like this:
# OPAC: http://<OPACPREFIX><INSTANCE NAME><OPACSUFFIX><DOMAIN>:<OPACPORT>
# STAFF: http://<INTRAPREFIX><INSTANCE NAME><INTRASUFFIX><DOMAIN>:<INTRAPORT>
DOMAIN=".{{domain}}"
INTRAPORT="80"
INTRAPREFIX=""
INTRASUFFIX="-intra"
OPACPORT="80"
OPACPREFIX=""
OPACSUFFIX=""
## Default data to be loaded
#
# DEFAULTSQL: filename
# Specify an SQL file with default data to load during instance creation
# The SQL file can be optionally compressed with gzip
# default: (empty)
DEFAULTSQL=""
## Zebra global configuration variables
#
# ZEBRA_MARC_FORMAT: 'marc21' | 'unimarc'
# Specifies the MARC records format for indexing
# default: 'marc21'
ZEBRA_MARC_FORMAT="marc21"
# ZEBRA_LANGUAGE: 'cs' | 'el' | 'en' | 'es' | 'fr' | 'nb' | 'ru' | 'uk'
# Primary language for Zebra indexing
# default: 'en'
ZEBRA_LANGUAGE="en"
## Memcached global configuration variables
#
# USE_MEMCACHED: 'yes' | 'no'
# Make the created instance use memcached. Can be altered later.
# default: 'yes'
USE_MEMCACHED="yes"
# MEMCACHED_SERVERS: comma separated list of memcached servers (ip:port)
# Specify a list of memcached servers for the Koha instance
# default: '127.0.0.1:11211'
MEMCACHED_SERVERS="127.0.0.1:11211"
# MEMCACHED_PREFIX:
# Specify a string to be used as prefix for defining the memcached namespace
# for the created instance.
# default: 'koha_'
MEMCACHED_PREFIX="koha_"

View file

@ -7,7 +7,7 @@ log_level: "INFO"
database_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/etherpad_{{ansible_hostname}}/db_password create=True nosymbols=true')}}"
pad_admin_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/etherpad_{{ansible_hostname}}/admin_password create=True nosymbols=true')}}"
plugins: ['ep_headings2', 'ep_table_of_contents', 'ep_comments_page', 'ep_align', 'ep_delete_after_delay_lite']
plugins: ['ep_headings2', 'ep_table_of_contents', 'ep_comments_page', 'ep_align']
pad_lang: 'it-IT'

View file

@ -26,14 +26,16 @@
become_user: "etherpad"
register: repository
- name: ensure etherpad init.d is latest
- name: ensure etherpad service is latest
become: yes
template:
src: etherpad.initd.j2
dest: /etc/init.d/etherpad
src: etherpad.service.j2
src: etherpad.service.j2
dest: /etc/systemd/system/etherpad.service
owner: root
group: root
mode: 0500
mode: 0644
notify: systemd reload
- name: copy etherpad settings.json
become: yes

View file

@ -1,77 +0,0 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: etherpad-lite
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts etherpad lite
# Description: starts etherpad lite using start-stop-daemon
### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/srv/etherpad/etherpad/etherpad-lite.log"
EPLITE_DIR="/srv/etherpad/etherpad"
EPLITE_BIN="bin/safeRun.sh"
USER="etherpad"
GROUP="etherpad"
DESC="Etherpad Lite"
NAME="etherpad-lite"
set -e
. /lib/lsb/init-functions
start() {
echo "Starting $DESC... "
start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE || true
echo "done"
}
#We need this function to ensure the whole process tree will be killed
killtree() {
local _pid=$1
local _sig=${2-TERM}
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
killtree ${_child} ${_sig}
done
kill -${_sig} ${_pid}
}
stop() {
echo "Stopping $DESC... "
while test -d /proc/$(cat /var/run/$NAME.pid); do
killtree $(cat /var/run/$NAME.pid) 15
sleep 0.5
done
rm /var/run/$NAME.pid
echo "done"
}
status() {
status_of_proc -p /var/run/$NAME.pid "" "etherpad-lite" && exit 0 || exit $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0

View file

@ -545,14 +545,6 @@
]
},
"ep_delete_after_delay_lite": {
"delay": 86400, // one day, in seconds
"loop": true,
"loopDelay": 3600, // one hour, in seconds
"deleteAtStart": true,
"text": "{{pad_default_text|replace("\n","\\n")}}"
},
"ep_toc": {
"disable_by_default": true
}

4
vars/koha.yml Normal file
View file

@ -0,0 +1,4 @@
---
domain: cisti.org
library_name: goliarda