From 6c4c271b7a3537f0646d4d5c130d86bd35d99006 Mon Sep 17 00:00:00 2001 From: lesion Date: Thu, 13 Jan 2022 00:52:13 +0100 Subject: [PATCH] start koha roles --- koha.yml | 8 +++ roles/koha/tasks/main.yml | 84 +++++++++++++++++++++++++ roles/koha/templates/koha-sites.conf.j2 | 52 +++++++++++++++ vars/koha.yml | 4 ++ 4 files changed, 148 insertions(+) create mode 100644 koha.yml create mode 100644 roles/koha/tasks/main.yml create mode 100644 roles/koha/templates/koha-sites.conf.j2 create mode 100644 vars/koha.yml diff --git a/koha.yml b/koha.yml new file mode 100644 index 0000000..6b6bc18 --- /dev/null +++ b/koha.yml @@ -0,0 +1,8 @@ +--- +## KOHA +- name: Koha + hosts: localhost + roles: ['stable/common', 'koha'] + vars_files: vars/koha.yml + tags: koha + diff --git a/roles/koha/tasks/main.yml b/roles/koha/tasks/main.yml new file mode 100644 index 0000000..1840503 --- /dev/null +++ b/roles/koha/tasks/main.yml @@ -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 + + + diff --git a/roles/koha/templates/koha-sites.conf.j2 b/roles/koha/templates/koha-sites.conf.j2 new file mode 100644 index 0000000..dd76a1a --- /dev/null +++ b/roles/koha/templates/koha-sites.conf.j2 @@ -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://: +# STAFF: http://: +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_" diff --git a/vars/koha.yml b/vars/koha.yml new file mode 100644 index 0000000..5317664 --- /dev/null +++ b/vars/koha.yml @@ -0,0 +1,4 @@ +--- +domain: cisti.org +library_name: goliarda +