mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Calibre-Web initial Import
This commit is contained in:
parent
ca75ef8234
commit
aac8913d2f
6 changed files with 156 additions and 0 deletions
31
roles/calibre-web/README.rst
Normal file
31
roles/calibre-web/README.rst
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
====================
|
||||||
|
Calibre Web README
|
||||||
|
====================
|
||||||
|
|
||||||
|
This Ansible role installs Calibre Web within Internet-in-a-Box. Calibre Web is
|
||||||
|
a web app providing a clean interface for browsing, reading and downloading eBooks
|
||||||
|
using an existing Calibre database.
|
||||||
|
|
||||||
|
Access
|
||||||
|
------
|
||||||
|
|
||||||
|
If enabled and with the default settings Calibre-web should be accessible at http://box/calibre-web.
|
||||||
|
This is front-end application running under Apache2 httpd.
|
||||||
|
|
||||||
|
To login to Calibre-web enter
|
||||||
|
|
||||||
|
Username: admin
|
||||||
|
|
||||||
|
Password: admin123
|
||||||
|
|
||||||
|
Backend
|
||||||
|
--------
|
||||||
|
You can manage the backend Calibre-web server manually with the following commands:
|
||||||
|
|
||||||
|
systemctl enable calibre-web
|
||||||
|
|
||||||
|
systemctl start calibre-web
|
||||||
|
|
||||||
|
systemctl status calibre-web
|
||||||
|
|
||||||
|
systemctl stop calibre-web
|
21
roles/calibre-web/defaults/main.yml
Normal file
21
roles/calibre-web/defaults/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# The values here are defaults.
|
||||||
|
# To override them edit /etc/iiab/local_vars.yml
|
||||||
|
|
||||||
|
# Installation Variables
|
||||||
|
calibre-web_install: False
|
||||||
|
calibre-web_enabled: False
|
||||||
|
|
||||||
|
# calibre-web folder to store its data and configuration files.
|
||||||
|
calibre-web_home: "{{ content_base }}/calibre-web"
|
||||||
|
|
||||||
|
calibre-web_http_port: 8083
|
||||||
|
calibre-web_url: /calibre-web
|
||||||
|
calibre-web_path: "{{ iiab_base }}/calibre-web"
|
||||||
|
calibre-web_exec_path: {{ calibre-web_path }}/cps.py
|
||||||
|
|
||||||
|
# calibre-web system user
|
||||||
|
calibre-web_user: root
|
||||||
|
|
||||||
|
# calibre-web admin account
|
||||||
|
# calibre-web_admin_user: admin
|
||||||
|
# calibre-web_admin_password: admin123
|
86
roles/calibre-web/tasks/main.yml
Normal file
86
roles/calibre-web/tasks/main.yml
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
- name: Create calibre-web folders to store data and configuration files
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
owner: "{{ calibre-web_user }}"
|
||||||
|
group: "{{ apache_user }}"
|
||||||
|
mode: 0755
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- "{{ calibre-web_home }}"
|
||||||
|
- "{{ calibre-web_path }}"
|
||||||
|
|
||||||
|
- name: Checkout calibre-web github repo
|
||||||
|
git:
|
||||||
|
repo: https://github.com/janeczku/calibre-web.git
|
||||||
|
dest: "{{ calibre-web_path }}"
|
||||||
|
update: yes
|
||||||
|
version: master
|
||||||
|
when: internet_available
|
||||||
|
|
||||||
|
- name: Download calibre-web dependencies
|
||||||
|
- pip:
|
||||||
|
chdir: "{{ calibre-web_path }}"
|
||||||
|
requirements: "{{ calibre-web_path }}/requirements.txt"
|
||||||
|
extra_args: "--target vendor --no-cache-dir"
|
||||||
|
|
||||||
|
- name: Create calibre-web systemd service unit, httpd2 configuration and initial database
|
||||||
|
template:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
mode: "{{ item.mode }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
with_items:
|
||||||
|
- { src: 'calibre-web.service.j2', dest: '/etc/systemd/system/calibre-web.service', mode: '0644' }
|
||||||
|
- { src: 'calibre-web.conf.j2', dest: '/etc/apache2/sites-available/calibre-web.conf', mode: '0644' }
|
||||||
|
- { src: 'metadata.db', dest: '{{ calibre-web_home }}/metadata.db', mode: '0644' }
|
||||||
|
|
||||||
|
- name: Ask systemd to reread unit files (daemon-reload)
|
||||||
|
systemd:
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
|
- name: Enable calibre-web service
|
||||||
|
service:
|
||||||
|
name: calibre-web
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
when: calibre-web_enabled
|
||||||
|
|
||||||
|
- name: Enable calibre-web httpd2 site
|
||||||
|
command: a2ensite calibre-web.conf
|
||||||
|
when: calibre-web_enabled
|
||||||
|
|
||||||
|
- name: Restart Apache after enabling calibre-web httpd2 site
|
||||||
|
command: apachectl -k graceful
|
||||||
|
when: calibre-web_enabled
|
||||||
|
|
||||||
|
- name: Disable calibre-web service
|
||||||
|
service:
|
||||||
|
name: calibre-web
|
||||||
|
enabled: no
|
||||||
|
state: stopped
|
||||||
|
when: not calibre-web_enabled
|
||||||
|
|
||||||
|
- name: Disable calibre-web httpd2 site
|
||||||
|
command: a2dissite calibre-web.conf
|
||||||
|
when: not calibre-web_enabled
|
||||||
|
|
||||||
|
- name: Add 'calibre-web' to list of services at /etc/iiab/iiab.ini
|
||||||
|
ini_file:
|
||||||
|
dest: "{{ service_filelist }}"
|
||||||
|
section: calibre-web
|
||||||
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
|
with_items:
|
||||||
|
- option: name
|
||||||
|
value: calibre-web
|
||||||
|
- option: description
|
||||||
|
value: '"calibre-web is a web app providing a clean interface for browsing, reading and downloading eBooks."'
|
||||||
|
- option: calibre-web_url
|
||||||
|
value: "{{ calibre-web_url }}"
|
||||||
|
- option: calibre-web_path
|
||||||
|
value: "{{ calibre-web_path }}"
|
||||||
|
- option: calibre-web_port
|
||||||
|
value: "{{ calibre-web_http_port }}"
|
||||||
|
- option: enabled
|
||||||
|
value: "{{ calibre-web_enabled }}"
|
8
roles/calibre-web/templates/calibre-web.conf.j2
Normal file
8
roles/calibre-web/templates/calibre-web.conf.j2
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<VirtualHost *:80>
|
||||||
|
<Location "{{ calibre-web_url }}" >
|
||||||
|
RequestHeader set X-SCRIPT-NAME {{ calibre-web_url }}
|
||||||
|
RequestHeader set X-SCHEME http
|
||||||
|
ProxyPass http://localhost:{{ calibre-web_http_port }}/
|
||||||
|
ProxyPassReverse http://localhost:{{ calibre-web_http_port }}/
|
||||||
|
</Location>
|
||||||
|
</VirtualHost>
|
10
roles/calibre-web/templates/calibre-web.service.j2
Normal file
10
roles/calibre-web/templates/calibre-web.service.j2
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Description=Calibre-Web
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User={{ calibre-web_user }}
|
||||||
|
ExecStart=/usr/bin/python " {{ calibre-web_exec_path }} "
|
||||||
|
WorkingDirectory={{ calibre-web_path }}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
BIN
roles/calibre-web/templates/metadata.db
Normal file
BIN
roles/calibre-web/templates/metadata.db
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue