1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/calibre-web/tasks/enable.yml

85 lines
2.8 KiB
YAML

- name: Enable & Restart 'calibre-web' systemd service
systemd:
name: calibre-web
daemon_reload: yes
enabled: yes
state: restarted
when: calibreweb_enabled | bool
- name: Disable & Stop 'calibre-web' systemd service
systemd:
name: calibre-web
enabled: no
state: stopped
when: not calibreweb_enabled
# SEE ALSO: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy
# Apache
# i.e. http://box/books, http://box/libros, http://box/livres
- name: Enable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} via Apache
command: a2ensite calibre-web.conf
when: apache_install and calibreweb_enabled
- name: Disable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} via Apache
command: a2dissite calibre-web.conf
when: apache_install and not calibreweb_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted
when: apache_enabled | bool
# NGINX
# TO DO: restore http://box/libros & http://box/livres, along English (http://box/books)
- name: Enable http://box{{ calibreweb_url1 }} via NGINX, by installing {{ nginx_config_dir }}/calibre-web-nginx.conf from template
template:
src: calibre-web-nginx.conf.j2
dest: "{{ nginx_config_dir }}/calibre-web-nginx.conf"
when: nginx_install and calibreweb_enabled
- name: Disable http://box{{ calibreweb_url1 }} via NGINX, by removing {{ nginx_config_dir }}/calibre-web-nginx.conf
file:
path: "{{ nginx_config_dir }}/calibre-web-nginx.conf"
state: absent
when: nginx_install and not calibreweb_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted
when: nginx_enabled | bool
- name: Add 'calibre-web' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: calibre-web
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: name
value: calibre-web
- option: description
value: '"Calibre-Web is a web app providing a clean interface for browsing, reading and downloading e-books."'
- option: calibreweb_url1
value: "{{ calibreweb_url1 }}"
- option: calibreweb_url2
value: "{{ calibreweb_url2 }}"
- option: calibreweb_url3
value: "{{ calibreweb_url3 }}"
- option: calibreweb_path
value: "{{ calibreweb_venv_path }}"
- option: calibreweb_home
value: "{{ calibreweb_home }}"
- option: calibreweb_port
value: "{{ calibreweb_port }}"
- option: calibreweb_database
value: "{{ calibreweb_database }}"
- option: calibreweb_enabled
value: "{{ calibreweb_enabled }}"