From 1779f5c3383f23cd9a6c825bd83874efc0a740a8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 01:36:42 -0600 Subject: [PATCH 01/12] remove extra / --- roles/nginx/templates/dokuwiki-nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/nginx/templates/dokuwiki-nginx.conf b/roles/nginx/templates/dokuwiki-nginx.conf index eb05289e5..9bbfe2cf7 100644 --- a/roles/nginx/templates/dokuwiki-nginx.conf +++ b/roles/nginx/templates/dokuwiki-nginx.conf @@ -1,3 +1,3 @@ location {{ dokuwiki_url }} { - proxy_pass http://127.0.0.1:{{ apache_port }}/{{ dokuwiki_url }}; + proxy_pass http://127.0.0.1:{{ apache_port }}{{ dokuwiki_url }}; } From 679790b1e7a58ec1ef50b49dda18861a114b2e06 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 00:54:40 -0600 Subject: [PATCH 02/12] nginx - softcode --- roles/nginx/tasks/main.yml | 6 +++--- roles/nginx/templates/server.conf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index 5c2dee6ed..937e22a27 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -6,7 +6,7 @@ - { src: "server.conf",dest: "/etc/nginx/" } - { src: "nginx.conf",dest: "/etc/nginx/" } - { src: "ports.conf" , dest: "/etc/{{ apache_service }}/" } - - { src: "iiab.conf.j2",dest: "/etc/nginx/conf.d/iiab.conf" } + - { src: "iiab.conf.j2",dest: "{{ nginx_config_dir }}/iiab.conf" } when: nginx_enabled - name: Clean stale config files @@ -14,8 +14,8 @@ state: absent path: '{{ item.path }}' with_items: - - { path: "/etc/nginx/conf.d/usb-lib.conf" } - - { path: "/etc/nginx/conf.d/modules.conf" } + - { path: "{{ nginx_config_dir }}/usb-lib.conf" } + - { path: "{{ nginx_config_dir }}/modules.conf" } - name: Insure that apache2 is not running -- we may need port swap systemd: diff --git a/roles/nginx/templates/server.conf b/roles/nginx/templates/server.conf index e734bde1f..47467aad8 100644 --- a/roles/nginx/templates/server.conf +++ b/roles/nginx/templates/server.conf @@ -10,7 +10,7 @@ server { index index.php index.html index.htm; # let individual services drop location blocks in conf.d - include /etc/nginx/conf.d/*; + include {{ nginx_config_dir }}/*; location ~ .*\.php$ { proxy_set_header X-Real-IP $remote_addr; From adde3b9369b4a5bf1a8448c8a3a6d472057b452d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 00:36:28 -0600 Subject: [PATCH 03/12] awstats - softcode nginx_config_dir --- roles/awstats/tasks/enable.yml | 6 +++--- roles/awstats/tasks/install.yml | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/roles/awstats/tasks/enable.yml b/roles/awstats/tasks/enable.yml index a80db27db..a795d1908 100644 --- a/roles/awstats/tasks/enable.yml +++ b/roles/awstats/tasks/enable.yml @@ -19,13 +19,13 @@ group: root mode: 0644 with_items: - - { src: "awstats-nginx.conf", dest: "/etc/nginx/conf.d/" } + - { src: "awstats-nginx.conf", dest: "{{ nginx_config_dir }}/" } - { src: "cgi-bin.php", dest: "/etc/nginx/" } when: awstats_enabled and nginx_enabled -- name: Remove /etc/nginx/conf.d/awstats-nginx.conf +- name: Remove {{ nginx_config_dir }}/awstats-nginx.conf file: - path: /etc/nginx/conf.d/awstats-nginx.conf + path: "{{ nginx_config_dir }}/awstats-nginx.conf" state: absent when: not awstats_enabled diff --git a/roles/awstats/tasks/install.yml b/roles/awstats/tasks/install.yml index ca62368e0..c33addfbb 100644 --- a/roles/awstats/tasks/install.yml +++ b/roles/awstats/tasks/install.yml @@ -44,8 +44,6 @@ group: root mode: 0644 with_items: -# - { src: "awstats-nginx.conf", dest: "/etc/nginx/conf.d/" } -# - { src: "cgi-bin.php", dest: "/etc/nginx/" } - { src: "apache-awstats.conf", dest: "/etc/{{ apache_config_dir }}/awstats.conf" } when: awstats_enabled and is_debuntu From 4cafb59538bd5393e2c37fb54a950e463e5fa05b Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Jan 2020 19:37:41 -0600 Subject: [PATCH 04/12] gitea - softcode nginx_config_dir, adjust restart for nginx --- roles/gitea/tasks/enable.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/roles/gitea/tasks/enable.yml b/roles/gitea/tasks/enable.yml index 5bfd1d729..909b3b42d 100644 --- a/roles/gitea/tasks/enable.yml +++ b/roles/gitea/tasks/enable.yml @@ -26,7 +26,7 @@ src: /etc/{{ apache_config_dir }}/gitea.conf dest: /etc/apache2/sites-enabled/gitea.conf state: link - when: gitea_enabled and is_debuntu + when: gitea_enabled and not nginx_enabled - name: Remove apache httpd conf file (OS's other than debuntu) file: @@ -36,21 +36,19 @@ - name: Remove nginx httpd conf file file: - path: /etc/nginx/conf.d/gitea-nginx.conf + path: "{{ nginx_config_dir }}/gitea-nginx.conf" state: absent when: not gitea_enabled - name: Enable nginx httpd conf file template: src: gitea-nginx.conf.j2 - dest: /etc/nginx/conf.d/gitea-nginx.conf + dest: "{{ nginx_config_dir }}/gitea-nginx.conf" when: gitea_enabled and nginx_enabled -- name: >- - Restart Apache ({{ apache_service }}) to {% if gitea_enabled %}enable{% - else %}disable{% endif %} http://box/gitea +- name: Restart nginx systemd: - name: "{{ apache_service }}" + name: nginx daemon_reload: yes state: restarted From e894d2217a2127109c68564ebee7ff7e1c70ba01 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Jan 2020 12:38:05 -0600 Subject: [PATCH 05/12] move wordpress-nginx.conf to enable.yml, add disable logic --- roles/wordpress/tasks/enable.yml | 21 ++++++++++++++++++++- roles/wordpress/tasks/install.yml | 6 ------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/roles/wordpress/tasks/enable.yml b/roles/wordpress/tasks/enable.yml index 3796a367b..7621df5e4 100644 --- a/roles/wordpress/tasks/enable.yml +++ b/roles/wordpress/tasks/enable.yml @@ -3,7 +3,7 @@ src: /etc/apache2/sites-available/wordpress.conf path: /etc/apache2/sites-enabled/wordpress.conf state: link - when: wordpress_enabled and is_debuntu + when: wordpress_enabled and not nginx_enabled - name: Remove /etc/apache2/sites-enabled/wordpress.conf if not wordpress_enabled (debuntu) file: @@ -11,10 +11,29 @@ state: absent when: not wordpress_enabled and is_debuntu +- name: Install {{ nginx_config_dir }}/wordpress-nginx.conf from template, for http://box{{ wp_url }} + template: + src: wordpress-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" + when: wordpress_enabled and nginx_enabled + +- name: Remove {{ nginx_config_dir }}/wordpress-nginx.conf if not wordpress_enabled (debuntu) + file: + path: "{{ nginx_config_dir }}/wordpress-nginx.conf" + state: absent + when: not wordpress_enabled and nginx_enabled + - name: Restart Apache service ({{ apache_service }}) to enable/disable http://box{{ wp_url }} systemd: name: "{{ apache_service }}" state: restarted + when: not nginx_enabled + +- name: Restart nginx service to enable/disable http://box{{ wp_url }} + systemd: + name: nginx + state: restarted + when: nginx_enabled - name: Add 'wordpress' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 4bf624f49..239e2ea56 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -101,12 +101,6 @@ dest: "/etc/{{ apache_config_dir }}/wordpress.conf" when: apache_enabled -- name: Install {{ nginx_config_dir }}/wordpress-nginx.conf from template, for http://box{{ wp_url }} - template: - src: wordpress-nginx.conf.j2 - dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" - when: nginx_enabled - - name: Add 'wordpress_installed' variable values to {{ iiab_state_file }} lineinfile: dest: "{{ iiab_state_file }}" From 07996d87b9f1603aae5f0a9dee25b93f5a044ac6 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Jan 2020 19:18:32 -0600 Subject: [PATCH 06/12] osm_v_m - softcode nginx_config_dir, adjust reload for nginx --- roles/osm-vector-maps/tasks/main.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/osm-vector-maps/tasks/main.yml b/roles/osm-vector-maps/tasks/main.yml index c698e3644..b17f97c2e 100644 --- a/roles/osm-vector-maps/tasks/main.yml +++ b/roles/osm-vector-maps/tasks/main.yml @@ -69,17 +69,17 @@ src: map_functions.js dest: '{{ vector_map_path }}/maplist/assets' -- name: Install /etc/nginx/conf.d/osm-vector-maps.conf from template +- name: Install {{ nginx_config_dir }}/osm-vector-maps.conf from template template: src: osm-vector-maps-nginx.conf - dest: "/etc/nginx/conf.d/osm-vector-maps-nginx.conf" - when: osm_vector_maps_enabled | bool + dest: "{{ nginx_config_dir }}/osm-vector-maps-nginx.conf" + when: osm_vector_maps_enabled -- name: Remove config /etc/nginx/conf,d/osm-vector-maps.conf (debuntu) +- name: Remove {{ nginx_config_dir }}/osm-vector-maps.conf (debuntu) file: - path: /etc/nginx/conf.d/osm-vector-maps-nginx.conf + path: "{{ nginx_config_dir }}/osm-vector-maps-nginx.conf" state: absent - when: not osm_vector_maps_enabled | bool + when: not osm_vector_maps_enabled #- name: Does the {{ vector_map_path }}/index.html redirect already exist? # stat: @@ -94,7 +94,7 @@ dest: "{{ vector_map_path }}/index.html" #when: not osm_redirect.stat.exists -- name: Reload Apache service ({{ apache_service }}) # e.g. apache2 +- name: Reload nginx systemd: - name: "{{ apache_service }}" + name: nginx state: reloaded From 3d9bf9c83a8143abe17416c2564fa5d178ce6226 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Jan 2020 19:25:59 -0600 Subject: [PATCH 07/12] sugarizer - softcode nginx_config_dir, add disable logic --- roles/sugarizer/tasks/enable.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/roles/sugarizer/tasks/enable.yml b/roles/sugarizer/tasks/enable.yml index 95db3155f..a7ae534fc 100644 --- a/roles/sugarizer/tasks/enable.yml +++ b/roles/sugarizer/tasks/enable.yml @@ -3,13 +3,13 @@ src: /etc/apache2/sites-available/sugarizer.conf path: /etc/apache2/sites-enabled/sugarizer.conf state: link - when: sugarizer_enabled | bool and not nginx_enabled | bool + when: sugarizer_enabled and not nginx_enabled - name: Remove symlink /etc/apache2/sites-enabled/sugarizer.conf (if not sugarizer_enabled) file: path: /etc/apache2/sites-enabled/sugarizer.conf state: absent - when: not sugarizer_enabled | bool or nginx_enabled | bool + when: not sugarizer_enabled or nginx_enabled - name: "Install sugarizer-nginx.conf (nginx)" template: @@ -19,8 +19,14 @@ owner: root group: root with_items: - - { src: 'sugarizer-nginx.conf', dest: '/etc/nginx/conf.d/sugarizer-nginx.conf' , mode: '0644' } - when: sugarizer_enabled | bool and nginx_enabled | bool + - { src: 'sugarizer-nginx.conf', dest: '{{ nginx_config_dir }}/sugarizer-nginx.conf', mode: '0644' } + when: sugarizer_enabled and nginx_enabled + +- name: Remove {{ nginx_config_dir }}/sugarizer-nginx.conf (if not sugarizer_enabled) + file: + path: "{{ nginx_config_dir }}/sugarizer-nginx.conf" + state: absent + when: not sugarizer_enabled and nginx_enabled # 6. RESTART/STOP SYSTEMD SERVICE @@ -31,7 +37,7 @@ daemon_reload: yes enabled: yes state: restarted - when: sugarizer_enabled | bool + when: sugarizer_enabled - name: Disable & Stop 'sugarizer' systemd service (if not sugarizer_enabled) systemd: @@ -62,7 +68,7 @@ systemd: name: "{{ apache_service }}" # httpd or apache2 state: restarted - when: sugarizer_enabled | bool and not nginx_enabled | bool + when: sugarizer_enabled and not nginx_enabled - name: Restart nginx when enabled systemd: From b7a148de63bbe283863d51936cbaec06f366a3e4 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Jan 2020 19:47:25 -0600 Subject: [PATCH 08/12] kiwix - softcode nginx_config_dir, add disable logic --- roles/kiwix/tasks/kiwix_enable.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_enable.yml b/roles/kiwix/tasks/kiwix_enable.yml index 9e0f63f32..cffee2647 100644 --- a/roles/kiwix/tasks/kiwix_enable.yml +++ b/roles/kiwix/tasks/kiwix_enable.yml @@ -3,7 +3,7 @@ src: /etc/apache2/sites-available/kiwix.conf path: /etc/apache2/sites-enabled/kiwix.conf state: link - when: kiwix_enabled | bool and not nginx_enabled | bool + when: kiwix_enabled and not nginx_enabled - name: Install nginx support template: @@ -14,14 +14,20 @@ 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 + - { src: 'kiwix-nginx.conf', dest: '{{ nginx_config_dir }}/kiwix-nginx.conf', mode: '0644' } + when: kiwix_enabled and nginx_enabled - 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 + when: not kiwix_enabled or nginx_enabled + +- name: Remove {{ nginx_config_dir }}/kiwix-nginx.conf + file: + path: "{{ nginx_config_dir }}/kiwix-nginx.conf" + state: absent + when: not kiwix_enabled and nginx_enabled - name: Enable & Restart 'kiwix-serve' service systemd: @@ -29,7 +35,7 @@ name: kiwix-serve enabled: yes state: restarted - when: kiwix_enabled | bool + when: kiwix_enabled - name: Disable 'kiwix-serve' service systemd: @@ -59,9 +65,19 @@ when: kiwix_enabled and is_redhat - name: Restart Apache, so it picks up kiwix.conf - service: + systemd: name: "{{ apache_service }}" state: restarted + daemon-reload: yes + when: not nginx_enabled + +- name: Restart nginx service + systemd: + name: nginx + state: restarted + daemon-reload: yes + when: nginx_enabled + # 5. FINALIZE From 61b5800c199a362f77f6233bab35e737494e4b29 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 00:22:47 -0600 Subject: [PATCH 09/12] calibre-web - softcode nginx_config_dir, add disable logic --- roles/calibre-web/tasks/enable.yml | 40 ++++++++++++++---------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/roles/calibre-web/tasks/enable.yml b/roles/calibre-web/tasks/enable.yml index 244c8b942..898a08697 100644 --- a/roles/calibre-web/tasks/enable.yml +++ b/roles/calibre-web/tasks/enable.yml @@ -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: From b31c2035a6719e21031f937a957ab1b7b9ce8f3d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 00:29:59 -0600 Subject: [PATCH 10/12] kolibri - softcode nginx_config_dir, add disable logic --- roles/kolibri/tasks/enable.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/roles/kolibri/tasks/enable.yml b/roles/kolibri/tasks/enable.yml index b2dca9682..484a9bdee 100644 --- a/roles/kolibri/tasks/enable.yml +++ b/roles/kolibri/tasks/enable.yml @@ -3,11 +3,7 @@ name: kolibri state: started enabled: yes - when: kolibri_enabled | bool - -- name: Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri - command: a2ensite kolibri.conf - when: kolibri_enabled | bool and not nginx_enabled | bool + when: kolibri_enabled - name: Disable & Stop 'kolibri' systemd service if not kolibri_enabled systemd: @@ -16,11 +12,15 @@ state: stopped when: not kolibri_enabled +- name: Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri + command: a2ensite kolibri.conf + when: kolibri_enabled and not nginx_enabled + - name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled command: a2dissite kolibri.conf - when: not kolibri_enabled or nginx_enabled | bool + when: not kolibri_enabled or nginx_enabled -- name: Supply /etc/nginx/conf.d/kolibri-nginx.conf when nginx_enabled +- name: Supply {{ nginx_config_dir }}/kolibri-nginx.conf when nginx_enabled template: src: "{{ item.src }}" dest: "{{ item.dest }}" @@ -28,24 +28,26 @@ owner: root group: root with_items: - - { src: 'kolibri-nginx.conf.j2', dest: '/etc/nginx/conf.d/kolibri-nginx.conf', mode: '0644' } - when: kolibri_enabled | bool and nginx_enabled | bool + - { src: 'kolibri-nginx.conf.j2', dest: '{{ nginx_config_dir }}/kolibri-nginx.conf', mode: '0644' } + when: kolibri_enabled and nginx_enabled -- name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled - command: a2dissite kolibri.conf - when: not kolibri_enabled or nginx_enabled | bool +- name: Remove {{ nginx_config_dir }}/kolibri-nginx.conf when not nginx_enabled + file: + path: "{{ nginx_config_dir }}/kolibri-nginx.conf" + state: absent + when: not kolibri_enabled and nginx_enabled - name: Restart Apache service ({{ apache_service }}) # e.g. apache2 systemd: name: "{{ apache_service }}" state: restarted - when: not nginx_enabled | bool + when: not nginx_enabled - name: Restart nginx service systemd: name: nginx state: restarted - when: nginx_enabled | bool + when: nginx_enabled - name: Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini ini_file: From dfe78fc1b8fa76baf53d33177271dfdb9d2e8de4 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 01:37:37 -0600 Subject: [PATCH 11/12] mediawiki tweaks --- roles/mediawiki/tasks/enable.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/roles/mediawiki/tasks/enable.yml b/roles/mediawiki/tasks/enable.yml index 3b780c43d..8d2370e96 100644 --- a/roles/mediawiki/tasks/enable.yml +++ b/roles/mediawiki/tasks/enable.yml @@ -3,12 +3,24 @@ src: /etc/apache2/sites-available/mediawiki.conf dest: /etc/apache2/sites-enabled/mediawiki.conf state: link - when: mediawiki_enabled and is_debuntu + when: mediawiki_enabled and not nginx_enabled - name: Remove mediawiki.conf if not mediawiki_enabled (debuntu) file: path: /etc/apache2/sites-enabled/mediawiki.conf state: absent + when: not mediawiki_enabled or nginx_enabled + +- name: Install {{ nginx_config_dir }}/mediawiki-nginx.conf from template, for http://box{{ mediawiki_url }} + template: + src: mediawiki-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/mediawiki-nginx.conf" + when: mediawiki_enabled and nginx_enabled + +- name: Remove mediawiki-nginx.conf if not mediawiki_enabled (debuntu) + file: + path: "{{ nginx_config_dir }}/mediawiki-nginx.conf" + state: absent when: not mediawiki_enabled and is_debuntu - name: Restart Apache service ({{ apache_service }}) to enable/disable http://box{{ mediawiki_url }} @@ -16,24 +28,14 @@ name: "{{ apache_service }}" daemon_reload: yes state: restarted - -- name: Install {{ nginx_config_dir }}/mediawiki-nginx.conf from template, for http://box{{ mediawiki_url }} - template: - src: mediawiki-nginx.conf.j2 - dest: "{{ nginx_config_dir }}/mediawiki-nginx.conf" - when: mediawiki_enabled - -- name: Remove mediawiki-nginx.conf if not mediawiki_enabled (debuntu) - file: - path: "{{ nginx_config_dir }}/mediawiki-nginx.conf" - state: absent - when: not mediawiki_enabled and is_debuntu + when: mediawiki_enabled and not nginx_enabled - name: Restart nginx service to enable/disable http://box{{ mediawiki_url }} systemd: name: nginx daemon_reload: yes state: restarted + when: nginx_enabled - name: Add 'mediawiki' variable values to {{ iiab_ini_file }} ini_file: From c61badf7f69a2e28f82e61c27c992b87f0935966 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 01:40:12 -0600 Subject: [PATCH 12/12] update to current state --- roles/nginx/README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/roles/nginx/README.md b/roles/nginx/README.md index 278b4f14c..eb67feb05 100644 --- a/roles/nginx/README.md +++ b/roles/nginx/README.md @@ -4,21 +4,24 @@ 3. Current state (10/16/19) 1. Principal functions migrated to nginx. * Admin Console - * Awstats * kalite -- goes directly to port 8009 - * usb-lib * maps + * usb-lib 2. Dual support - * kiwix -- goes directly to port 3000 + * Awstats * calibre-web + * gitea + * kiwix -- goes directly to port 3000 * kolibri - * sugarizer - 3. Still proxied to Apache * mediawiki + * sugarizer + * wordpress + 3. Still proxied to Apache + * dokuwiki * elgg + * lokole + * moodle * nodered * nextcloud - * wordpress - * moodle 4. Not dealt with yet * archive.org