1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

calibre-web - softcode nginx_config_dir, add disable logic

This commit is contained in:
Jerry Vonau 2020-01-04 00:22:47 -06:00
parent b7a148de63
commit 61b5800c19

View file

@ -4,17 +4,7 @@
daemon_reload: yes
enabled: yes
state: restarted
when: calibreweb_enabled | bool
# Default: http://box/books
# SEE ALSO: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy
- name: Enable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2ensite calibre-web.conf
when: calibreweb_enabled | bool
#- name: Restart Apache after enabling calibre-web httpd2 site
# command: apachectl -k graceful
# when: calibreweb_enabled | bool
when: calibreweb_enabled
- name: Disable 'calibre-web' systemd service
systemd:
@ -24,15 +14,17 @@
state: stopped
when: not calibreweb_enabled
# Default: http://box/books
# SEE ALSO: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy
- name: Enable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2ensite calibre-web.conf
when: calibreweb_enabled and not nginx_enabled
- name: Disable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2dissite calibre-web.conf
when: not calibreweb_enabled or nginx_enabled | bool
when: not calibreweb_enabled or nginx_enabled | bool and apache_install
#- name: Restart Apache after disabling calibre-web httpd2 site
# command: apachectl -k graceful
# when: not calibreweb_enabled
- name: Install /etc/nginx/conf.d/calibre-web-nginx.conf
- name: Install {{ nginx_config_dir }}/calibre-web-nginx.conf
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
@ -40,20 +32,26 @@
owner: root
group: root
with_items:
- { src: 'calibre-web-nginx.conf.j2', dest: '/etc/nginx/conf.d/calibre-web-nginx.conf', mode: '0644' }
when: calibreweb_enabled | bool and nginx_enabled | bool
- { src: 'calibre-web-nginx.conf.j2', dest: '{{ nginx_config_dir }}/calibre-web-nginx.conf', mode: '0644' }
when: calibreweb_enabled and nginx_enabled
- name: Remove {{ nginx_config_dir }}/calibre-web-nginx.conf
file:
path: {{ nginx_config_dir }}/calibre-web-nginx.conf
state: absent
when: not calibreweb_enabled and nginx_enabled
- name: Restart nginx systemd service
systemd:
name: nginx
state: restarted
when: calibreweb_enabled | bool and nginx_enabled | bool
when: calibreweb_enabled and nginx_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # httpd or apache2
state: restarted
when: not nginx_enabled | bool
when: not nginx_enabled
- name: Add 'calibre-web' variable values to {{ iiab_ini_file }}
ini_file: