1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/calibre/tasks/main.yml
2017-11-20 02:04:40 -05:00

81 lines
No EOL
2.4 KiB
YAML

- name: Check if /library/calibre/metadata.db exists
stat:
path: "{{ calibre_dbpath }}/metadata.db"
register: calibre_db
# INSTALL THE LATEST CALIBRE (calibre-server etc) ON ALL OS'S - RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST
- name: Install Calibre via calibre-installer.py
include_tasks: installer.yml
when: not calibre_db.stat.exists and (is_redhat or is_ubuntu)
- name: Install Calibre via .debs
include_tasks: debs.yml
when: not calibre_db.stat.exists and is_debian
# CREATE CALIBRE DATABASE WITH A SAMPLE BOOK
- name: Install Calibre - All
include_tasks: config-db.yml
when: not calibre_db.stat.exists
# WRAP UP CALIBRE INSTALLATION
- name: Create calibre-serve.service and calibre.conf
template:
backup: no
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: "{{ item.mode }}"
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'}
# http://box:8080 & http://box:8080/mobile WORK BUT OTHER URL'S LIKE http://box/books ARE A MESS (BOOKS RARELY DISPLAY)
- name: Create calibre.conf link for UNTESTED http://box/books etc (debuntu)
file:
src: /etc/apache2/sites-available/calibre.conf
dest: /etc/apache2/sites-enabled/calibre.conf
state: link
when: is_debuntu
- name: Enable Calibre service -- runs calibre-server by Kovid Goyal
service:
name: calibre-serve
enabled: yes
state: started
#async: 900
#poll: 5
when: calibre_enabled
#- name: Remove calibre.conf link if disabled (debuntu)
# file:
# dest: /etc/apache2/sites-enabled/calibre.conf
# state: absent
# when: not calibre_enabled and is_debuntu
#- name: Disable Calibre service -- stops calibre-server by Kovid Goyal
# service: name=calibre-serve
# enabled=no
# state=stopped
# when: not calibre_enabled
- name: Add 'calibre-serve' to service list
ini_file:
dest: "{{ service_filelist }}"
section: calibre
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- 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 }}"
- option: enabled
value: "{{ calibre_enabled }}"