1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/calibre/tasks/main.yml

152 lines
5.3 KiB
YAML
Raw Normal View History

2018-05-10 20:13:58 +00:00
# 1. INSTALL THE LATEST CALIBRE 3.X+ (calibre, calibredb, calibre-server etc) ON ALL OS'S
2017-05-27 18:09:50 +00:00
2018-10-31 06:05:59 +00:00
- name: Does /usr/bin/calibre exist?
2018-05-10 20:13:58 +00:00
stat:
path: "/usr/bin/calibre"
register: calib_executable
2019-02-03 01:06:41 +00:00
- name: "Install OS's latest packages: calibre, calibre-bin (IF not rpi AND /usr/bin/calibre MISSING)"
2018-05-10 20:13:58 +00:00
package:
2018-10-28 18:31:44 +00:00
name:
- calibre
- calibre-bin
2018-05-10 20:13:58 +00:00
state: latest
2018-08-30 14:27:50 +00:00
when: internet_available and not is_rpi and (not calib_executable.stat.exists)
2018-08-30 18:14:15 +00:00
- name: Install Calibre .debs IF calibre_via_debs (AND /usr/bin/calibre WAS MISSING)
2017-11-19 20:33:53 +00:00
include_tasks: debs.yml
2018-08-30 18:14:15 +00:00
when: calibre_via_debs and (not calib_executable.stat.exists)
2018-05-10 20:13:58 +00:00
- name: Install Calibre via calibre-installer.py IF calibre_via_python (AND /usr/bin/calibre WAS MISSING)
include_tasks: py-installer.yml
when: calibre_via_python and (not calib_executable.stat.exists)
2018-05-10 20:13:58 +00:00
# SEE calibre_via_python's value vars/default_vars.yml, vars/ubuntu-18.yml &
# vars/raspbian-9.yml: try to AVOID Python installer on Raspbian since its
# .deb's (http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/)
# are updated within about 10 days of Calibre's quasi-monthly releases!
#
# BUT IF ABSOLUTELY NEC: (SEE roles/calibre/tasks/debs.yml)
# - run testing branch for RPi: scripts/calibre-install-latest-rpi.sh
# - run testing branch for Ubuntu 16.04: scripts/calibre-install-latest.sh
# - run unstable branch for Debian etc: scripts/calibre-install-unstable.sh
2017-11-19 20:33:53 +00:00
2018-07-07 20:20:28 +00:00
- name: Create calibre-serve.service and calibre.conf (IF /usr/bin/calibre WAS MISSING)
2017-12-07 16:06:37 +00:00
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: "{{ item.mode }}"
2017-12-07 16:27:19 +00:00
backup: no
2018-10-31 06:05:59 +00:00
#register: calibre_config
2017-12-07 16:06:37 +00:00
with_items:
- { src: 'calibre-serve.service.j2', dest: '/etc/systemd/system/calibre-serve.service', mode: '0644'}
- { src: 'calibre.conf', dest: '/etc/{{ apache_config_dir }}', mode: '0644'}
2018-07-07 19:54:44 +00:00
when: (not calib_executable.stat.exists)
2018-07-07 20:20:28 +00:00
- name: Force systemd to reread configs (IF /usr/bin/calibre WAS MISSING)
2017-12-07 16:22:03 +00:00
systemd:
daemon_reload: yes
2018-07-07 19:54:44 +00:00
when: (not calib_executable.stat.exists)
2018-10-31 06:05:59 +00:00
#when: calibre_config.changed
2017-12-07 16:06:37 +00:00
2019-02-03 00:26:58 +00:00
# 2. STOP CALIBRE SERVICE (REQUIRED FOR DB ACTIVITY...AND IF not calibre_enabled)
2017-11-20 08:25:53 +00:00
#- name: Check if Calibre systemd service exists
# stat:
# path: /etc/systemd/system/calibre-serve.service
# register: calibre_svc
2017-11-20 08:25:53 +00:00
2019-02-03 00:26:58 +00:00
- name: Stop service 'calibre-serve' (/usr/bin/calibre-server by Kovid Goyal)
2018-10-31 06:05:59 +00:00
systemd:
2017-11-20 08:25:53 +00:00
name: calibre-serve
state: stopped
#enabled: no
2018-10-31 06:05:59 +00:00
#register: command_result # gist.github.com/tyrells/0a79681de339237cb04c
#failed_when: False # Never Fail during "systemctl stop calibre-serve" (even if service doesn't exist!)
2018-10-31 06:05:59 +00:00
#when: calibre_svc.stat.exists
2017-11-20 08:25:53 +00:00
# 3. CREATE USER DATABASE
- name: Create /library/calibre (mandatory since Calibre 3.x)
file:
path: "{{ calibre_dbpath }}"
state: directory
#mode: 0755
- name: Copy template userdb to /library/calibre/users.sqlite (IF /usr/bin/calibre WAS MISSING)
copy:
src: /opt/iiab/iiab/roles/calibre/templates/users.sqlite
dest: "{{ calibre_userdb }}"
owner: root
group: root
mode: 0644
when: (not calib_executable.stat.exists)
# 4. CREATE CONTENT DATABASE WITH A SAMPLE BOOK (REQUIRED AS OF CALIBRE 3.x)
2018-10-31 06:05:59 +00:00
- name: Does /library/calibre/metadata.db exist?
2017-11-20 08:01:38 +00:00
stat:
path: "{{ calibre_dbpath }}/metadata.db"
register: calibre_db
2017-11-20 08:13:00 +00:00
- name: Create database (required since Calibre 3.x) with a sample book
include_tasks: create-db.yml
2017-11-19 19:53:41 +00:00
when: not calibre_db.stat.exists
2017-05-27 18:09:50 +00:00
# 5. WRAP UP: ENABLE CALIBRE SERVICE, http://box/books ETC
2017-05-27 18:09:50 +00:00
2018-08-28 01:45:12 +00:00
# http://box:8080 & http://box:8080/mobile WORK BUT OTHER URL'S LIKE http://box/calibre ARE A MESS (BOOKS RARELY DISPLAY)
#
# 2018-08-27 POSSIBLE FIX...CONSIDER THIS ProxyPass / ProxyPassReverse TECHNIQUE:
# https://github.com/iiab/iiab/tree/master/roles/calibre-web/templates/calibre-web.conf.j2
# (anyway this works great for calibre-web, allowing http://box/books
# to work even better than http://box:8083 when box == 192.168.0.x !)
2018-10-31 06:05:59 +00:00
- name: Create symlink calibre.conf from sites-enabled to sites-available, for UNTESTED http://box/calibre etc (debuntu)
file:
src: /etc/apache2/sites-available/calibre.conf
dest: /etc/apache2/sites-enabled/calibre.conf
state: link
when: calibre_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-31 06:05:59 +00:00
- name: Remove symlink /etc/apache2/sites-enabled/calibre.conf (debuntu)
2017-11-20 08:01:38 +00:00
file:
dest: /etc/apache2/sites-enabled/calibre.conf
state: absent
2017-11-20 08:32:40 +00:00
when: (not calibre_enabled) and is_debuntu
2017-11-20 08:01:38 +00:00
2019-02-03 00:26:58 +00:00
- name: Enable & Start service 'calibre-serve' (/usr/bin/calibre-server by Kovid Goyal)
service:
name: calibre-serve
enabled: yes
state: started
when: calibre_enabled | bool
2017-11-20 08:03:25 +00:00
#async: 900
#poll: 5
2017-05-27 18:09:50 +00:00
2019-02-03 01:15:39 +00:00
- name: Reload Apache service ({{ apache_service }})
2018-10-31 06:05:59 +00:00
systemd:
2017-12-06 16:44:58 +00:00
name: "{{ apache_service }}"
state: reloaded
2018-10-31 06:05:59 +00:00
- name: Add 'calibre' variable values to {{ iiab_ini_file }}
ini_file:
2018-10-31 06:05:59 +00:00
path: "{{ iiab_ini_file }}"
section: calibre
option: "{{ item.option }}"
value: "{{ item.value }}"
2017-05-27 18:09:50 +00:00
with_items:
2017-11-27 01:22:16 +00:00
- option: name
value: Calibre
- option: description
value: '"Calibre is an extremely popular personal library system for e-books."'
- option: url
value: "{{ calibre_src_url }}"
- option: database
value: "{{ calibre_dbpath }}"
- option: port
value: "{{ calibre_port }}"
0.3 patch1 (#1377) * expand zim_versions_idx to include menuItem name, mediaCount, articleCount, size * create a stub menuItem if none exists * remember to change consumer of zim_version_idx in iiab-admin * comment out some debugging prints * do not change the name of a variable in iiab.ini * consistent variable names for *_enabled * start work on menus for enabled iiab roles * changes to display cups in home menu * remove reference to admin console which may not be installed * print error message * dict.get errors * handle undefined menuItem" * handle undefined menuItem again * some work on logos * break out the zim_versions_idx routines for use by update_menus in admin-console * remove old menuDef creation code * new variable names for zim_versions_idx * missing the tags data in zim_versions_idx * un-break-apart iiab-make-kiwix-lib.py * return an empty string * make size human_readable * getting console and iiab to work together on menus * add the new zim_date field to zim_versions_idx * get the latest into repo * found lost code iiab-make-kiwix-lib.py * Create Lokole admin user during setup * Add requested content to lokole readme Per iiab/iiab#1293 * Update default password * Add Lokole-IIAB user manual * Update default_vars.yml * Update local_vars_min.yml * Update local_vars_min.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update default_vars.yml * Update default_vars.yml * Update local_vars_min.yml * Update local_vars_medium.yml * Update local_vars_big.yml * Update default_vars.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Change admin username to uppercase * Revert "Lokole: change admin to Admin per IIAB app norms" * Update main.yml * Update README.rst * Update capture-wsgi.py * Update main.yml * Update main.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Address TODOs in Lokole documentation See https://github.com/ascoderu/opwen-webapp/issues/81 * Update main.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_big.yml * Update local_vars_min.yml * Update default_vars.yml * expand zim_versions_idx to include menuItem name, mediaCount, articleCount, size * create a stub menuItem if none exists * remember to change consumer of zim_version_idx in iiab-admin * comment out some debugging prints * do not change the name of a variable in iiab.ini * consistent variable names for *_enabled * start work on menus for enabled iiab roles * changes to display cups in home menu * remove reference to admin console which may not be installed * print error message * dict.get errors * handle undefined menuItem" * handle undefined menuItem again * some work on logos * break out the zim_versions_idx routines for use by update_menus in admin-console * remove old menuDef creation code * new variable names for zim_versions_idx * missing the tags data in zim_versions_idx * un-break-apart iiab-make-kiwix-lib.py * return an empty string * make size human_readable * getting console and iiab to work together on menus * add the new zim_date field to zim_versions_idx * get the latest into repo * found lost code iiab-make-kiwix-lib.py
2019-01-10 22:26:47 +00:00
- option: calibre_enabled
2017-12-07 16:26:04 +00:00
value: "{{ calibre_enabled }}"