2020-04-30 00:10:52 +00:00
# 1. INSTALL CALIBRE 3.39.1+ or 4.12+ (calibre, calibredb, calibre-server etc) ON ALL OS'S
2020-04-29 22:41:15 +00:00
2020-04-29 23:52:22 +00:00
- name : "Install OS's latest packages: calibre, calibre-bin"
package :
name :
- calibre
- calibre-bin
state : latest
2020-04-29 22:41:15 +00:00
2020-04-30 00:06:33 +00:00
# 2020-04-29: AT YOUR OWN RISK, this *sometimes* works, e.g. to upgrade from
# Raspbian 10's Calibre 3.39.1 to "4.99.4+dfsg+really4.12.0-1" or higher, from:
# http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/
# http://archive.raspbian.org/raspbian/pool/main/c/calibre/
#
#- name: Install Calibre via .debs (if Raspbian)
# command: scripts/calibre-install-latest-rpi.sh # WORKED for Calibre 3.33.1 on 2018-10-23. And Calibre 3.28 on 2018-07-26 (PR #971). Likewise for Calibre 3.26.x. FAILED with Calibre 3.24+ ("calibre : Depends: python-pyqt5 (>= 5.10.1+dfsg-2) but 5.10.1+dfsg-1+rpi1 is to be installed") since June 2018.
2020-10-16 20:46:19 +00:00
# when: is_raspbian
2020-04-29 22:41:15 +00:00
2020-04-29 23:52:22 +00:00
# 2020-04-29: Can work *IF* you do 'apt install python2' and change top line
# of /opt/iiab/downloads/calibre-installer.py from '#!/usr/bin/env python2'
2020-04-30 00:10:52 +00:00
# to '#!/usr/bin/python2' e.g. to upgrade Calibre 4.12 on Ubuntu 20.04 LTS.
2020-04-29 23:52:22 +00:00
#
#- name: Install Calibre via py-installer.yml -> calibre-installer.py (if not Raspbian)
# include_tasks: py-installer.yml
2020-04-30 00:06:33 +00:00
# when: not is_raspbian # True Debian or any Ubuntu?
2019-09-14 22:26:37 +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
2020-01-30 09:00:00 +00:00
# 2. SYSTEMD SERVICES
2021-07-07 05:46:01 +00:00
- name: 'Install from template : /etc/systemd/system/calibre-serve.service'
2019-09-14 22:26:37 +00:00
template :
src : "{{ item.src }}"
dest : "{{ item.dest }}"
with_items :
2020-04-30 18:02:36 +00:00
- { src: 'calibre-serve.service.j2', dest : '/etc/systemd/system/calibre-serve.service' }
2021-07-07 05:46:01 +00:00
#- { src: 'calibre.conf', dest: '/etc/{{ apache_conf_dir }}' } # apache2/sites-available (this doesn't work, see #529: let's try to create /etc/nginx/conf.d/calibre-nginx.conf in future!)
2019-09-14 22:26:37 +00:00
- name : Stop service 'calibre-serve' (/usr/bin/calibre-server by Kovid Goyal)
systemd :
name : calibre-serve
state : stopped
daemon_reload : yes
2020-01-30 09:00:00 +00:00
2019-09-14 22:26:37 +00:00
# 3. CREATE USER DATABASE
2020-04-29 22:41:15 +00:00
- name : Create {{ calibre_dbpath }} (mandatory since Calibre 3.x)
2019-09-14 22:26:37 +00:00
file :
2020-04-29 22:41:15 +00:00
path : "{{ calibre_dbpath }}" # /library/calibre
2019-09-14 22:26:37 +00:00
state : directory
2020-04-29 22:41:15 +00:00
- name : Copy template userdb to {{ calibre_userdb }}
2019-09-14 22:26:37 +00:00
copy :
src : /opt/iiab/iiab/roles/calibre/templates/users.sqlite
2020-04-29 22:41:15 +00:00
dest : "{{ calibre_userdb }}" # /library/calibre/users.sqlite
2019-09-14 22:26:37 +00:00
2020-01-30 09:00:00 +00:00
2019-09-14 22:26:37 +00:00
# 4. CREATE CONTENT DATABASE WITH A SAMPLE BOOK (REQUIRED AS OF CALIBRE 3.x)
- name : Does /library/calibre/metadata.db exist?
stat :
path : "{{ calibre_dbpath }}/metadata.db"
register : calibre_db
- name : Create database (required since Calibre 3.x) with a sample book
include_tasks : create-db.yml
when : not calibre_db.stat.exists
2020-01-30 09:00:00 +00:00
# 5. RECORD Calibre AS INSTALLED
- name : "Set 'calibre_installed: True'"
set_fact :
calibre_installed : True
2020-01-12 23:15:33 +00:00
- name : "Add 'calibre_installed: True' to {{ iiab_state_file }}"
2019-09-14 22:26:37 +00:00
lineinfile :
2020-02-04 00:54:04 +00:00
path : "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
2020-01-12 22:06:24 +00:00
regexp : '^calibre_installed'
2019-10-07 17:11:21 +00:00
line: 'calibre_installed : True '