From 3e9ffb8987b50304bf8831e456c823a31203b96a Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 20 Oct 2019 09:02:40 -0500 Subject: [PATCH] kiwix - add when nginx_enabled - restart2 --- roles/kiwix/tasks/kiwix_install.yml | 35 +++++++++++++++++-- .../templates/kiwix-nginx.conf} | 0 roles/nginx/files/README.md | 12 ++++--- 3 files changed, 40 insertions(+), 7 deletions(-) rename roles/{nginx/templates/kiwix.conf => kiwix/templates/kiwix-nginx.conf} (100%) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 542df81a5..99ceed5bd 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -104,7 +104,25 @@ src: /etc/apache2/sites-available/kiwix.conf path: /etc/apache2/sites-enabled/kiwix.conf state: link - when: is_debuntu | bool + when: kiwix_enabled | bool and not nginx_enabled | bool + +- name: Install nginx support + template: + backup: no + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: root + group: root + mode: "{{ item.mode }}" + with_items: + - { src: 'kiwix-nginx.conf', dest: '/etc/nginx/conf.d/kiwix-nginx.conf', mode: '0644' } + when: kiwix_enabled | bool and nginx_enabled | bool + +- name: Remove symlink /etc/apache2/sites-enabled/kiwix.conf + file: + path: /etc/apache2/sites-enabled/kiwix.conf + state: absent + when: not kiwix_enabled | bool or nginx_enabled | bool - name: Enable & Restart 'kiwix-serve' service systemd: @@ -142,9 +160,22 @@ when: kiwix_enabled and is_redhat - name: Restart Apache, so it picks up kiwix.conf - service: + systemd: name: "{{ apache_service }}" state: restarted + when: not nginx_enabled | bool + +- name: Remove nginx support for kiwix + file: + path: /etc/nginx/conf.d/kiwix-nginx.conf + state: absent + when: not kiwix_enabled | bool + +- name: Restart nginx, so it picks up kiwix-nginx.conf state + systemd: + name: nginx + state: restarted + when: nginx_enabled | bool # 5. FINALIZE diff --git a/roles/nginx/templates/kiwix.conf b/roles/kiwix/templates/kiwix-nginx.conf similarity index 100% rename from roles/nginx/templates/kiwix.conf rename to roles/kiwix/templates/kiwix-nginx.conf diff --git a/roles/nginx/files/README.md b/roles/nginx/files/README.md index cb178b7b5..278b4f14c 100644 --- a/roles/nginx/files/README.md +++ b/roles/nginx/files/README.md @@ -5,18 +5,20 @@ 1. Principal functions migrated to nginx. * Admin Console * Awstats - * kiwix -- goes directly to port 3000 * kalite -- goes directly to port 8009 - * calibre-web - * kolibri * usb-lib * maps - 2. Still proxied to Apache + 2. Dual support + * kiwix -- goes directly to port 3000 + * calibre-web + * kolibri + * sugarizer + 3. Still proxied to Apache * mediawiki * elgg * nodered * nextcloud * wordpress * moodle - 3. Not dealt with yet + 4. Not dealt with yet * archive.org