- name: Check if /library/calibre/metadata.db exists stat: path: "{{ calibre_dbpath }}/metadata.db" register: calibre_db - name: Installing Calibre via calibre-installer.py include_tasks: installing.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 - name: Install Calibre - All include_tasks: install.yml when: not calibre_db.stat.exists - 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'} when: calibre_enabled # 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: calibre_enabled and 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 }}"