From 4e7eaa4c02de6dfa66115650165df2a1681e8f2f Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 12 Jan 2020 02:15:47 -0500 Subject: [PATCH 1/3] Prune 30 lines from nginx/tasks/only_nginx.yml --- roles/nginx/tasks/only_nginx.yml | 42 +++++--------------------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/roles/nginx/tasks/only_nginx.yml b/roles/nginx/tasks/only_nginx.yml index f3c26719f..e97117913 100644 --- a/roles/nginx/tasks/only_nginx.yml +++ b/roles/nginx/tasks/only_nginx.yml @@ -1,15 +1,10 @@ - name: Remove symlink /etc/apache2/sites-enabled/awstats.conf - file: - path: /etc/apache2/sites-enabled/awstats.conf - state: absent + command: a2dissite awstats.conf - name: Install /etc/nginx/conf.d/awstats-nginx.conf from template, if awstats_enabled template: src: roles/awstats/templates/awstats-nginx.conf dest: /etc/nginx/conf.d/awstats-nginx.conf - # owner: root - # group: root - # mode: '0644' when: awstats_enabled | bool - name: Remove NGINX support for AWStats, if not awstats_enabled @@ -20,17 +15,12 @@ - name: Remove symlink /etc/apache2/sites-enabled/calibre-web.conf - file: - path: /etc/apache2/sites-enabled/calibre-web.conf - state: absent + command: a2dissite calibre-web.conf - name: Install /etc/nginx/conf.d/calibre-web-nginx.conf from template, if calibreweb_enabled template: src: roles/calibre-web/templates/calibre-web-nginx.conf.j2 dest: /etc/nginx/conf.d/calibre-web-nginx.conf - # owner: root - # group: root - # mode: '0644' when: calibreweb_enabled | bool - name: Remove NGINX support for Calibre-Web, if not calibreweb_enabled @@ -41,17 +31,12 @@ - name: Remove symlink /etc/apache2/sites-enabled/gitea.conf - file: - path: /etc/apache2/sites-enabled/gitea.conf - state: absent + command: a2dissite gitea.conf - name: Install /etc/nginx/conf.d/gitea-nginx.conf from template, if gitea_enabled template: src: roles/gitea/templates/gitea-nginx.conf.j2 dest: /etc/nginx/conf.d/gitea-nginx.conf - # owner: root - # group: root - # mode: '0644' when: gitea_enabled | bool - name: Remove NGINX support for Gitea, if not gitea_enabled @@ -62,17 +47,12 @@ - name: Remove symlink /etc/apache2/sites-enabled/kiwix.conf - file: - path: /etc/apache2/sites-enabled/kiwix.conf - state: absent + command: a2dissite kiwix.conf - name: Install /etc/nginx/conf.d/kiwix-nginx.conf from template, if kiwix_enabled template: src: roles/kiwix/templates/kiwix-nginx.conf dest: /etc/nginx/conf.d/kiwix-nginx.conf - # owner: root - # group: root - # mode: '0644' when: kiwix_enabled | bool - name: Remove NGINX support for Kiwix, if not kiwix_enabled @@ -83,17 +63,12 @@ - name: Remove symlink /etc/apache2/sites-enabled/kolibri.conf - file: - path: /etc/apache2/sites-enabled/kolibri.conf - state: absent + command: a2dissite kolibri.conf - name: Install /etc/nginx/conf.d/kolibri-nginx.conf from template, if kolibri_enabled template: src: roles/kolibri/templates/kolibri-nginx.conf.j2 dest: /etc/nginx/conf.d/kolibri-nginx.conf - # owner: root - # group: root - # mode: '0644' when: kolibri_enabled | bool - name: Remove NGINX support for Kolibri, if not kolibri_enabled @@ -104,17 +79,12 @@ - name: Remove symlink /etc/apache2/sites-enabled/sugarizer.conf - file: - path: /etc/apache2/sites-enabled/sugarizer.conf - state: absent + command: a2dissite sugarizer.conf - name: Install /etc/nginx/conf.d/sugarizer-nginx.conf from template, if sugarizer_enabled template: src: roles/sugarizer/templates/sugarizer-nginx.conf dest: /etc/nginx/conf.d/sugarizer-nginx.conf - # owner: root - # group: root - # mode: '0644' when: sugarizer_enabled | bool - name: Remove NGINX support for Sugarizer, if not sugarizer_enabled From 6caa5d88bd4bf37fa1f400066a5d2e6eb1105905 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 12 Jan 2020 02:24:16 -0500 Subject: [PATCH 2/3] NOTE only_nginx.yml duplicates what's in enable.yml's --- roles/nginx/tasks/only_nginx.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/nginx/tasks/only_nginx.yml b/roles/nginx/tasks/only_nginx.yml index e97117913..73f9f7c7a 100644 --- a/roles/nginx/tasks/only_nginx.yml +++ b/roles/nginx/tasks/only_nginx.yml @@ -1,3 +1,7 @@ +# The ~100 lines of code below is near-identical to what's in tasks/enable.yml +# for these 6 playbooks. Any way we can consolidate / reduce duplication? + + - name: Remove symlink /etc/apache2/sites-enabled/awstats.conf command: a2dissite awstats.conf From 3f4fb6a3b6797a3327717d2e8bb9c9b50857ae31 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 12 Jan 2020 02:29:49 -0500 Subject: [PATCH 3/3] /etc/nginx/conf.d -> {{ nginx_config_dir }} in nginx/tasks/uses_apache.yml --- roles/nginx/tasks/uses_apache.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/roles/nginx/tasks/uses_apache.yml b/roles/nginx/tasks/uses_apache.yml index 41725fc90..4818626f8 100644 --- a/roles/nginx/tasks/uses_apache.yml +++ b/roles/nginx/tasks/uses_apache.yml @@ -1,37 +1,41 @@ -- name: Install /etc/nginx/conf.d/dokuwiki-nginx.conf from template, if dokuwiki_enabled +# The ~40 lines of code below are near-identical to what's in tasks/enable.yml +# for these 6 playbooks. Any way PR #2131 etc can help reduce duplication? + + +- name: Install {{ nginx_config_dir }}/dokuwiki-nginx.conf from template, if dokuwiki_enabled template: src: dokuwiki-nginx.conf - dest: /etc/nginx/conf.d/dokuwiki-nginx.conf + dest: {{ nginx_config_dir }}/dokuwiki-nginx.conf # /etc/nginx/conf.d when: dokuwiki_enabled | bool -- name: Install /etc/nginx/conf.d/elgg-nginx.conf from template, if elgg_enabled +- name: Install {{ nginx_config_dir }}/elgg-nginx.conf from template, if elgg_enabled template: src: elgg-nginx.conf - dest: /etc/nginx/conf.d/elgg-nginx.conf + dest: {{ nginx_config_dir }}/elgg-nginx.conf # /etc/nginx/conf.d when: elgg_enabled | bool -- name: Install /etc/nginx/conf.d/lokole-nginx.conf from template, if lokole_enabled +- name: Install {{ nginx_config_dir }}/lokole-nginx.conf from template, if lokole_enabled template: src: lokole-nginx.conf.j2 - dest: /etc/nginx/conf.d/lokole-nginx.conf + dest: {{ nginx_config_dir }}/lokole-nginx.conf # /etc/nginx/conf.d when: lokole_enabled | bool -- name: Install /etc/nginx/conf.d/moodle-nginx.conf from template, if moodle_enabled +- name: Install {{ nginx_config_dir }}/moodle-nginx.conf from template, if moodle_enabled template: src: moodle-nginx.conf.j2 - dest: /etc/nginx/conf.d/moodle-nginx.conf + dest: {{ nginx_config_dir }}/moodle-nginx.conf # /etc/nginx/conf.d when: moodle_enabled | bool -- name: Install /etc/nginx/conf.d/nextcloud-nginx.conf from template, if nextcloud_enabled +- name: Install {{ nginx_config_dir }}/nextcloud-nginx.conf from template, if nextcloud_enabled template: src: nextcloud-nginx.conf - dest: /etc/nginx/conf.d/nextcloud-nginx.conf + dest: {{ nginx_config_dir }}/nextcloud-nginx.conf # /etc/nginx/conf.d when: nextcloud_enabled | bool -- name: Install /etc/nginx/conf.d/nodered-nginx.conf from template, if nodered_enabled +- name: Install {{ nginx_config_dir }}/nodered-nginx.conf from template, if nodered_enabled template: src: nodered-nginx.conf.j2 - dest: /etc/nginx/conf.d/nodered-nginx.conf + dest: {{ nginx_config_dir }}/nodered-nginx.conf # /etc/nginx/conf.d # mode: '0666' when: nodered_enabled | bool