# 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 !)
#
#- name: Attempt to enable http://box/calibre via Apache (UNTESTED)
#  command: a2ensite calibre.conf
#  when: apache_installed and calibre_enabled
#
#- name: Attempt to disable http://box/calibre via Apache (UNTESTED)
#  command: a2dissite calibre.conf
#  when: apache_installed and not calibre_enabled

- name: Enable & (Re)Start 'calibre-serve' service, if calibre_enabled
  systemd:
    daemon_reload: yes
    name: calibre-serve
    enabled: yes
    state: restarted
  when: calibre_enabled

- name: Disable & Stop 'calibre-serve' service, if not calibre_enabled
  systemd:
    name: calibre-serve
    enabled: no
    state: stopped
  when: not calibre_enabled
