From efd62be6060c2d6be9239769c7f09d277fae35dd Mon Sep 17 00:00:00 2001 From: root Date: Wed, 12 Feb 2020 20:53:36 -0500 Subject: [PATCH] Try roles/www_back_end in Stage 3 & roles/www_front_end in Stage 4 --- roles/3-base-server/tasks/main.yml | 7 +- roles/4-server-options/tasks/main.yml | 32 +++------ roles/9-local-addons/tasks/main.yml | 4 +- roles/httpd/tasks/homepage.yml | 17 +++++ roles/httpd/tasks/install.yml | 23 +------ roles/nginx/tasks/enable-or-disable.yml | 4 +- roles/nginx/tasks/homepage.yml | 9 +++ roles/nginx/tasks/install.yml | 10 ++- .../files/html/assets/lang_codes.json | 0 .../files/html/css/bootstrap-theme.css | 0 .../files/html/css/bootstrap-theme.css.map | 0 .../files/html/css/bootstrap-theme.min.css | 0 .../html/css/bootstrap-theme.min.css.map | 0 .../files/html/css/bootstrap.css | 0 .../files/html/css/bootstrap.css.map | 0 .../files/html/css/bootstrap.min.css | 0 .../files/html/css/bootstrap.min.css.map | 0 .../files/html/css/bootstrap4.min.css | 0 .../files/html/css/fa.all.min.css | 0 .../files/html/css/font-faces.css | 0 .../files/html/css/xo-common.css | 0 .../bubblegum-sans-v6-latin-regular.woff | Bin .../bubblegum-sans-v6-latin-regular.woff2 | Bin .../files/html/fonts/fa-solid-900.woff | Bin .../files/html/fonts/fa-solid-900.woff2 | Bin .../fonts/finger-paint-v7-latin-regular.woff | Bin .../fonts/finger-paint-v7-latin-regular.woff2 | Bin .../html/fonts/flavors-v6-latin-regular.woff | Bin .../html/fonts/flavors-v6-latin-regular.woff2 | Bin .../fonts/freckle-face-v6-latin-regular.woff | Bin .../fonts/freckle-face-v6-latin-regular.woff2 | Bin .../fonts/glyphicons-halflings-regular.eot | Bin .../fonts/glyphicons-halflings-regular.svg | 0 .../fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin .../html/fonts/open-sans-v15-latin-600.woff | Bin .../html/fonts/open-sans-v15-latin-600.woff2 | Bin .../html/fonts/open-sans-v15-latin-700.woff | Bin .../html/fonts/open-sans-v15-latin-700.woff2 | Bin .../fonts/open-sans-v15-latin-regular.woff | Bin .../fonts/open-sans-v15-latin-regular.woff2 | Bin .../files/html/html/credits.html | 0 .../files/html/js/Markdown.Converter.js | 0 .../files/html/js/Markdown.Sanitizer.js | 0 .../files/html/js/XMLDisplay.js | 0 .../files/html/js/bootstrap.js | 0 .../files/html/js/bootstrap.min.js | 0 .../files/html/js/bootstrap4.min.js | 0 .../files/html/js/jquery.min.js | 0 .../files/html/services/power_off.php | 0 .../tasks/html.yml | 0 .../tasks/main.yml | 35 ++++++---- .../tasks/php-stem.yml | 0 .../templates/iiab-refresh-wiki-docs.sh | 0 roles/www_front_end/tasks/main.yml | 61 ++++++++++++++++++ .../templates/020_apache_poweroff.j2 | 0 tests/test.yml | 3 +- 57 files changed, 139 insertions(+), 66 deletions(-) create mode 100644 roles/httpd/tasks/homepage.yml create mode 100644 roles/nginx/tasks/homepage.yml rename roles/{web_support => www_back_end}/files/html/assets/lang_codes.json (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap-theme.css (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap-theme.css.map (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap-theme.min.css (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap-theme.min.css.map (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap.css (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap.css.map (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap.min.css (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap.min.css.map (100%) rename roles/{web_support => www_back_end}/files/html/css/bootstrap4.min.css (100%) rename roles/{web_support => www_back_end}/files/html/css/fa.all.min.css (100%) rename roles/{web_support => www_back_end}/files/html/css/font-faces.css (100%) rename roles/{web_support => www_back_end}/files/html/css/xo-common.css (100%) rename roles/{web_support => www_back_end}/files/html/fonts/bubblegum-sans-v6-latin-regular.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/bubblegum-sans-v6-latin-regular.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/fonts/fa-solid-900.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/fa-solid-900.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/fonts/finger-paint-v7-latin-regular.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/finger-paint-v7-latin-regular.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/fonts/flavors-v6-latin-regular.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/flavors-v6-latin-regular.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/fonts/freckle-face-v6-latin-regular.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/freckle-face-v6-latin-regular.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/fonts/glyphicons-halflings-regular.eot (100%) rename roles/{web_support => www_back_end}/files/html/fonts/glyphicons-halflings-regular.svg (100%) rename roles/{web_support => www_back_end}/files/html/fonts/glyphicons-halflings-regular.ttf (100%) rename roles/{web_support => www_back_end}/files/html/fonts/glyphicons-halflings-regular.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/open-sans-v15-latin-600.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/open-sans-v15-latin-600.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/fonts/open-sans-v15-latin-700.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/open-sans-v15-latin-700.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/fonts/open-sans-v15-latin-regular.woff (100%) rename roles/{web_support => www_back_end}/files/html/fonts/open-sans-v15-latin-regular.woff2 (100%) rename roles/{web_support => www_back_end}/files/html/html/credits.html (100%) rename roles/{web_support => www_back_end}/files/html/js/Markdown.Converter.js (100%) rename roles/{web_support => www_back_end}/files/html/js/Markdown.Sanitizer.js (100%) rename roles/{web_support => www_back_end}/files/html/js/XMLDisplay.js (100%) rename roles/{web_support => www_back_end}/files/html/js/bootstrap.js (100%) rename roles/{web_support => www_back_end}/files/html/js/bootstrap.min.js (100%) rename roles/{web_support => www_back_end}/files/html/js/bootstrap4.min.js (100%) rename roles/{web_support => www_back_end}/files/html/js/jquery.min.js (100%) rename roles/{web_support => www_back_end}/files/html/services/power_off.php (100%) rename roles/{web_support => www_back_end}/tasks/html.yml (100%) rename roles/{web_support => www_back_end}/tasks/main.yml (69%) rename roles/{web_support => www_back_end}/tasks/php-stem.yml (100%) rename roles/{web_support => www_back_end}/templates/iiab-refresh-wiki-docs.sh (100%) create mode 100644 roles/www_front_end/tasks/main.yml rename roles/{web_support => www_front_end}/templates/020_apache_poweroff.j2 (100%) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index 715d59b1c..a4895f44b 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -8,10 +8,11 @@ name: mysql when: mysql_install | bool -- name: WEB_SUPPORT +- name: WWW_BACK_END (WWW_FRONT_END should be installed later) include_role: - name: web_support - when: apache_install or nginx_install + name: www_back_end + # when: www_back_end | bool + # when: apache_install or nginx_install - name: HTTPD (Apache) include_role: diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index 0decf2a4b..0ee84f133 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -27,11 +27,6 @@ name: usb_lib when: usb_lib_install | bool -# 2020-02-12: what was roles/homepage lives in roles/web_support & roles/httpd -# for now. Eventually softcoding of iiab_home_url should happen everywhere -# (incl Admin Console) to allow more field options, e.g. changing -# /library/www/html/home even when offline... - - name: CUPS include_role: name: cups @@ -42,25 +37,16 @@ name: samba when: samba_install | bool -# 2020-02-12: DOES THE FLAG BELOW (apache_allow_sudo) WORK WITH NGINX TOO ? -# COMPARE apache_high_php_limits @ web_support/tasks/main.yml +# 2020-02-12: what was roles/homepage lives in roles/www_back_end & +# roles/www_front_end for now. Eventually softcoding of iiab_home_url +# should happen everywhere (incl Admin Console) to allow more field +# options, e.g. changing /library/www/html/home even when offline... -- name: Give {{ apache_user }} (per variable apache_user) permission to poweroff, installing /etc/sudoers.d/020_apache_poweroff from template - template: - src: roles/web_support/templates/020_apache_poweroff.j2 - dest: /etc/sudoers.d/020_apache_poweroff - mode: '0755' - when: apache_allow_sudo | bool - -- name: Remove {{ apache_user }} (per variable apache_user) permission to poweroff, removing /etc/sudoers.d/020_apache_poweroff - file: - path: /etc/sudoers.d/020_apache_poweroff - state: absent - when: not apache_allow_sudo - -- name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (This script was installed in Stage 3 = roles/3-base-server/tasks/main.yml, which ran roles/web_support/tasks/main.yml) - command: /usr/bin/iiab-refresh-wiki-docs - when: internet_available and not nodocs +- name: WWW_FRONT_END (WWW_BACK_END should have been installed earlier) + include_role: + name: www_front_end + # when: www_front_end | bool + # when: apache_install or nginx_install - name: Recording STAGE 4 HAS COMPLETED ================== lineinfile: diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index 2ab2ce0b2..00f7712dd 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -30,8 +30,8 @@ name: calibre-web when: calibreweb_install | bool -# Could split these two below to Stage 10? 2020-02-11: Experimentally moving -# stuff below to roles/web_support, 4-server-options, roles/httpd, roles/nginx. +# Could split these two below to Stage 10? 2020-02-12: Experimentally moving +# stuff to roles/3-base-server, 4-server-options, roles/httpd, roles/nginx. # - name: "Set 'nginx_enabled: True'" # set_fact: diff --git a/roles/httpd/tasks/homepage.yml b/roles/httpd/tasks/homepage.yml new file mode 100644 index 000000000..25773ba31 --- /dev/null +++ b/roles/httpd/tasks/homepage.yml @@ -0,0 +1,17 @@ +# Both invoked in 4-SERVER-OPTIONS, by roles/www_front_end/tasks/main.yml: +# +# httpd/tasks/homepage.yml +# nginx/tasks/homepage.yml + +- name: Install /etc/{{ apache_conf_dir }}/iiab-homepage.conf from httpd/templates, so Apache redirects http://box to http://box{{ iiab_home_url }} # /home + template: + src: roles/httpd/templates/iiab-homepage.conf + dest: "/etc/{{ apache_conf_dir }}/iiab-homepage.conf" # apache2/sites-available (on debuntu) + +- name: "IN CASE NGINX IS DISABLED: Enable IIAB pages via Apache (e.g. on port 80) by running 'a2ensite iiab-homepage.conf'" + command: a2ensite iiab-homepage.conf + #when: apache_enabled | bool + +# - name: Disable IIAB pages via Apache (e.g. on port 80) by running 'a2dissite iiab-homepage.conf', if not apache_enabled" +# command: a2dissite iiab-homepage.conf +# when: not apache_enabled diff --git a/roles/httpd/tasks/install.yml b/roles/httpd/tasks/install.yml index 723f7bfdb..8ffd6382f 100644 --- a/roles/httpd/tasks/install.yml +++ b/roles/httpd/tasks/install.yml @@ -156,26 +156,9 @@ # command: a2dissite 010-iiab.conf # when: not apache_enabled -# MOVED FROM roles/homepage/tasks/main.yml (as NGINX-only IIAB's won't need it) -# and 'mkdir /library/www/html/home' is now done by web_support/tasks/main.yml -# for Admin Console which hard-codes that as a requirement, as of 2020-02-12. -# -# './runrole --reinstall apache' is a decent solution today, for folks needing -# changes, but to make sure such things work in the field/offline/etc: soft- -# coding of iiab_home_url should probably be taken more seriously thruout IIAB! -# -- name: Install /etc/{{ apache_conf_dir }}/iiab-homepage.conf from template, for http://box redirect to http://box/home/ - template: - src: iiab-homepage.conf - dest: "/etc/{{ apache_conf_dir }}/iiab-homepage.conf" - -- name: "IN CASE NGINX IS DISABLED: Enable iiab-homepage.conf via Apache (e.g. on port 80) by running 'a2ensite iiab-homepage.conf'" - command: a2ensite iiab-homepage.conf - #when: apache_enabled | bool - -# - name: Disable IIAB pages via Apache (e.g. on port 80) by running 'a2dissite iiab-homepage.conf', if not apache_enabled" -# command: a2dissite iiab-homepage.conf -# when: not apache_enabled +- debug: + msg: roles/httpd/tasks/homepage.yml will run LATER (invoked by roles/www_front_end/tasks/main.yml) SO THAT APACHE CAN REDIRECT http://box TO http://box{{ iiab_home_url }} (based on var iiab_home_url) +# - include_tasks: roles/httpd/tasks/homepage.yml # - name: Enable & Stop '{{ apache_service }}' systemd service # systemd: diff --git a/roles/nginx/tasks/enable-or-disable.yml b/roles/nginx/tasks/enable-or-disable.yml index edd6cb2a8..beebc2da5 100644 --- a/roles/nginx/tasks/enable-or-disable.yml +++ b/roles/nginx/tasks/enable-or-disable.yml @@ -6,13 +6,13 @@ - name: Install /etc/{{ apache_service }}/ports.conf from template 1 of 2 (ports.conf.j2) if nginx_enabled, to enable Apache port {{ apache_port }} localhost only template: src: ports.conf.j2 - dest: "/etc/{{ apache_service }}/ports.conf" # apache2 or httpd + dest: "/etc/{{ apache_service }}/ports.conf" when: nginx_enabled | bool - name: Install /etc/{{ apache_service }}/ports.conf from template 2 of 2 (stock-apache-ports.conf) if not nginx_enabled, to disable Apache port {{ apache_port }} localhost only template: src: stock-apache-ports.conf - dest: "/etc/{{ apache_service }}/ports.conf" # apache2 or httpd + dest: "/etc/{{ apache_service }}/ports.conf" when: not nginx_enabled - name: Enable & Restart '{{ apache_service }}' if apache_enabled or not nginx_enabled, since we stopped it diff --git a/roles/nginx/tasks/homepage.yml b/roles/nginx/tasks/homepage.yml new file mode 100644 index 000000000..fb01aa96f --- /dev/null +++ b/roles/nginx/tasks/homepage.yml @@ -0,0 +1,9 @@ +# Both invoked in 4-SERVER-OPTIONS, by roles/www_front_end/tasks/main.yml: +# +# httpd/tasks/homepage.yml +# nginx/tasks/homepage.yml + +- name: Install {{ nginx_conf_dir }}/iiab.conf from nginx/templates, so NGINX redirects http://box to http://box{{ iiab_home_url }} # /home + template: + src: roles/nginx/templates/iiab.conf.j2 + dest: "{{ nginx_conf_dir }}/iiab.conf" # /etc/nginx/conf.d diff --git a/roles/nginx/tasks/install.yml b/roles/nginx/tasks/install.yml index 6b3a7e25b..2fb3f2e44 100644 --- a/roles/nginx/tasks/install.yml +++ b/roles/nginx/tasks/install.yml @@ -35,7 +35,7 @@ path: /etc/nginx/sites-enabled/default state: absent -- name: 'Install 3 files from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, {{ nginx_conf_dir }}/iiab.conf' +- name: 'Install 2 (of 4) files from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf' template: src: "{{ item.src }}" dest: "{{ item.dest }}" @@ -43,9 +43,13 @@ - { src: 'server.conf.j2', dest: '/etc/nginx/server.conf' } - { src: 'nginx.conf.j2', dest: '/etc/nginx/nginx.conf' } #- { src: 'ports.conf.j2', dest: '/etc/{{ apache_service }}/ports.conf' } # Moved to enable-or-disable.yml - - { src: 'iiab.conf.j2', dest: "{{ nginx_conf_dir }}/iiab.conf" } # /etc/nginx/conf.d + #- { src: 'iiab.conf.j2', dest: "{{ nginx_conf_dir }}/iiab.conf" } # Moved into homepage.yml below -# php-stem extension installed by roles/web_support/tasks/php-stem.yml +- debug: + msg: roles/nginx/tasks/homepage.yml will run LATER (invoked by roles/www_front_end/tasks/main.yml) SO THAT NGINX CAN REDIRECT http://box TO http://box{{ iiab_home_url }} (based on var iiab_home_url) +# - include_tasks: roles/nginx/tasks/homepage.yml + +# php-stem extension installed by roles/www_back_end/tasks/php-stem.yml # here it is linked to php-fpm - name: Symlink /etc/php/{{ php_version }}/fpm/conf.d/20-stem.ini -> /etc/php/{{ php_version }}/mods-available/stem.ini file: diff --git a/roles/web_support/files/html/assets/lang_codes.json b/roles/www_back_end/files/html/assets/lang_codes.json similarity index 100% rename from roles/web_support/files/html/assets/lang_codes.json rename to roles/www_back_end/files/html/assets/lang_codes.json diff --git a/roles/web_support/files/html/css/bootstrap-theme.css b/roles/www_back_end/files/html/css/bootstrap-theme.css similarity index 100% rename from roles/web_support/files/html/css/bootstrap-theme.css rename to roles/www_back_end/files/html/css/bootstrap-theme.css diff --git a/roles/web_support/files/html/css/bootstrap-theme.css.map b/roles/www_back_end/files/html/css/bootstrap-theme.css.map similarity index 100% rename from roles/web_support/files/html/css/bootstrap-theme.css.map rename to roles/www_back_end/files/html/css/bootstrap-theme.css.map diff --git a/roles/web_support/files/html/css/bootstrap-theme.min.css b/roles/www_back_end/files/html/css/bootstrap-theme.min.css similarity index 100% rename from roles/web_support/files/html/css/bootstrap-theme.min.css rename to roles/www_back_end/files/html/css/bootstrap-theme.min.css diff --git a/roles/web_support/files/html/css/bootstrap-theme.min.css.map b/roles/www_back_end/files/html/css/bootstrap-theme.min.css.map similarity index 100% rename from roles/web_support/files/html/css/bootstrap-theme.min.css.map rename to roles/www_back_end/files/html/css/bootstrap-theme.min.css.map diff --git a/roles/web_support/files/html/css/bootstrap.css b/roles/www_back_end/files/html/css/bootstrap.css similarity index 100% rename from roles/web_support/files/html/css/bootstrap.css rename to roles/www_back_end/files/html/css/bootstrap.css diff --git a/roles/web_support/files/html/css/bootstrap.css.map b/roles/www_back_end/files/html/css/bootstrap.css.map similarity index 100% rename from roles/web_support/files/html/css/bootstrap.css.map rename to roles/www_back_end/files/html/css/bootstrap.css.map diff --git a/roles/web_support/files/html/css/bootstrap.min.css b/roles/www_back_end/files/html/css/bootstrap.min.css similarity index 100% rename from roles/web_support/files/html/css/bootstrap.min.css rename to roles/www_back_end/files/html/css/bootstrap.min.css diff --git a/roles/web_support/files/html/css/bootstrap.min.css.map b/roles/www_back_end/files/html/css/bootstrap.min.css.map similarity index 100% rename from roles/web_support/files/html/css/bootstrap.min.css.map rename to roles/www_back_end/files/html/css/bootstrap.min.css.map diff --git a/roles/web_support/files/html/css/bootstrap4.min.css b/roles/www_back_end/files/html/css/bootstrap4.min.css similarity index 100% rename from roles/web_support/files/html/css/bootstrap4.min.css rename to roles/www_back_end/files/html/css/bootstrap4.min.css diff --git a/roles/web_support/files/html/css/fa.all.min.css b/roles/www_back_end/files/html/css/fa.all.min.css similarity index 100% rename from roles/web_support/files/html/css/fa.all.min.css rename to roles/www_back_end/files/html/css/fa.all.min.css diff --git a/roles/web_support/files/html/css/font-faces.css b/roles/www_back_end/files/html/css/font-faces.css similarity index 100% rename from roles/web_support/files/html/css/font-faces.css rename to roles/www_back_end/files/html/css/font-faces.css diff --git a/roles/web_support/files/html/css/xo-common.css b/roles/www_back_end/files/html/css/xo-common.css similarity index 100% rename from roles/web_support/files/html/css/xo-common.css rename to roles/www_back_end/files/html/css/xo-common.css diff --git a/roles/web_support/files/html/fonts/bubblegum-sans-v6-latin-regular.woff b/roles/www_back_end/files/html/fonts/bubblegum-sans-v6-latin-regular.woff similarity index 100% rename from roles/web_support/files/html/fonts/bubblegum-sans-v6-latin-regular.woff rename to roles/www_back_end/files/html/fonts/bubblegum-sans-v6-latin-regular.woff diff --git a/roles/web_support/files/html/fonts/bubblegum-sans-v6-latin-regular.woff2 b/roles/www_back_end/files/html/fonts/bubblegum-sans-v6-latin-regular.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/bubblegum-sans-v6-latin-regular.woff2 rename to roles/www_back_end/files/html/fonts/bubblegum-sans-v6-latin-regular.woff2 diff --git a/roles/web_support/files/html/fonts/fa-solid-900.woff b/roles/www_back_end/files/html/fonts/fa-solid-900.woff similarity index 100% rename from roles/web_support/files/html/fonts/fa-solid-900.woff rename to roles/www_back_end/files/html/fonts/fa-solid-900.woff diff --git a/roles/web_support/files/html/fonts/fa-solid-900.woff2 b/roles/www_back_end/files/html/fonts/fa-solid-900.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/fa-solid-900.woff2 rename to roles/www_back_end/files/html/fonts/fa-solid-900.woff2 diff --git a/roles/web_support/files/html/fonts/finger-paint-v7-latin-regular.woff b/roles/www_back_end/files/html/fonts/finger-paint-v7-latin-regular.woff similarity index 100% rename from roles/web_support/files/html/fonts/finger-paint-v7-latin-regular.woff rename to roles/www_back_end/files/html/fonts/finger-paint-v7-latin-regular.woff diff --git a/roles/web_support/files/html/fonts/finger-paint-v7-latin-regular.woff2 b/roles/www_back_end/files/html/fonts/finger-paint-v7-latin-regular.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/finger-paint-v7-latin-regular.woff2 rename to roles/www_back_end/files/html/fonts/finger-paint-v7-latin-regular.woff2 diff --git a/roles/web_support/files/html/fonts/flavors-v6-latin-regular.woff b/roles/www_back_end/files/html/fonts/flavors-v6-latin-regular.woff similarity index 100% rename from roles/web_support/files/html/fonts/flavors-v6-latin-regular.woff rename to roles/www_back_end/files/html/fonts/flavors-v6-latin-regular.woff diff --git a/roles/web_support/files/html/fonts/flavors-v6-latin-regular.woff2 b/roles/www_back_end/files/html/fonts/flavors-v6-latin-regular.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/flavors-v6-latin-regular.woff2 rename to roles/www_back_end/files/html/fonts/flavors-v6-latin-regular.woff2 diff --git a/roles/web_support/files/html/fonts/freckle-face-v6-latin-regular.woff b/roles/www_back_end/files/html/fonts/freckle-face-v6-latin-regular.woff similarity index 100% rename from roles/web_support/files/html/fonts/freckle-face-v6-latin-regular.woff rename to roles/www_back_end/files/html/fonts/freckle-face-v6-latin-regular.woff diff --git a/roles/web_support/files/html/fonts/freckle-face-v6-latin-regular.woff2 b/roles/www_back_end/files/html/fonts/freckle-face-v6-latin-regular.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/freckle-face-v6-latin-regular.woff2 rename to roles/www_back_end/files/html/fonts/freckle-face-v6-latin-regular.woff2 diff --git a/roles/web_support/files/html/fonts/glyphicons-halflings-regular.eot b/roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from roles/web_support/files/html/fonts/glyphicons-halflings-regular.eot rename to roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.eot diff --git a/roles/web_support/files/html/fonts/glyphicons-halflings-regular.svg b/roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from roles/web_support/files/html/fonts/glyphicons-halflings-regular.svg rename to roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.svg diff --git a/roles/web_support/files/html/fonts/glyphicons-halflings-regular.ttf b/roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from roles/web_support/files/html/fonts/glyphicons-halflings-regular.ttf rename to roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.ttf diff --git a/roles/web_support/files/html/fonts/glyphicons-halflings-regular.woff b/roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from roles/web_support/files/html/fonts/glyphicons-halflings-regular.woff rename to roles/www_back_end/files/html/fonts/glyphicons-halflings-regular.woff diff --git a/roles/web_support/files/html/fonts/open-sans-v15-latin-600.woff b/roles/www_back_end/files/html/fonts/open-sans-v15-latin-600.woff similarity index 100% rename from roles/web_support/files/html/fonts/open-sans-v15-latin-600.woff rename to roles/www_back_end/files/html/fonts/open-sans-v15-latin-600.woff diff --git a/roles/web_support/files/html/fonts/open-sans-v15-latin-600.woff2 b/roles/www_back_end/files/html/fonts/open-sans-v15-latin-600.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/open-sans-v15-latin-600.woff2 rename to roles/www_back_end/files/html/fonts/open-sans-v15-latin-600.woff2 diff --git a/roles/web_support/files/html/fonts/open-sans-v15-latin-700.woff b/roles/www_back_end/files/html/fonts/open-sans-v15-latin-700.woff similarity index 100% rename from roles/web_support/files/html/fonts/open-sans-v15-latin-700.woff rename to roles/www_back_end/files/html/fonts/open-sans-v15-latin-700.woff diff --git a/roles/web_support/files/html/fonts/open-sans-v15-latin-700.woff2 b/roles/www_back_end/files/html/fonts/open-sans-v15-latin-700.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/open-sans-v15-latin-700.woff2 rename to roles/www_back_end/files/html/fonts/open-sans-v15-latin-700.woff2 diff --git a/roles/web_support/files/html/fonts/open-sans-v15-latin-regular.woff b/roles/www_back_end/files/html/fonts/open-sans-v15-latin-regular.woff similarity index 100% rename from roles/web_support/files/html/fonts/open-sans-v15-latin-regular.woff rename to roles/www_back_end/files/html/fonts/open-sans-v15-latin-regular.woff diff --git a/roles/web_support/files/html/fonts/open-sans-v15-latin-regular.woff2 b/roles/www_back_end/files/html/fonts/open-sans-v15-latin-regular.woff2 similarity index 100% rename from roles/web_support/files/html/fonts/open-sans-v15-latin-regular.woff2 rename to roles/www_back_end/files/html/fonts/open-sans-v15-latin-regular.woff2 diff --git a/roles/web_support/files/html/html/credits.html b/roles/www_back_end/files/html/html/credits.html similarity index 100% rename from roles/web_support/files/html/html/credits.html rename to roles/www_back_end/files/html/html/credits.html diff --git a/roles/web_support/files/html/js/Markdown.Converter.js b/roles/www_back_end/files/html/js/Markdown.Converter.js similarity index 100% rename from roles/web_support/files/html/js/Markdown.Converter.js rename to roles/www_back_end/files/html/js/Markdown.Converter.js diff --git a/roles/web_support/files/html/js/Markdown.Sanitizer.js b/roles/www_back_end/files/html/js/Markdown.Sanitizer.js similarity index 100% rename from roles/web_support/files/html/js/Markdown.Sanitizer.js rename to roles/www_back_end/files/html/js/Markdown.Sanitizer.js diff --git a/roles/web_support/files/html/js/XMLDisplay.js b/roles/www_back_end/files/html/js/XMLDisplay.js similarity index 100% rename from roles/web_support/files/html/js/XMLDisplay.js rename to roles/www_back_end/files/html/js/XMLDisplay.js diff --git a/roles/web_support/files/html/js/bootstrap.js b/roles/www_back_end/files/html/js/bootstrap.js similarity index 100% rename from roles/web_support/files/html/js/bootstrap.js rename to roles/www_back_end/files/html/js/bootstrap.js diff --git a/roles/web_support/files/html/js/bootstrap.min.js b/roles/www_back_end/files/html/js/bootstrap.min.js similarity index 100% rename from roles/web_support/files/html/js/bootstrap.min.js rename to roles/www_back_end/files/html/js/bootstrap.min.js diff --git a/roles/web_support/files/html/js/bootstrap4.min.js b/roles/www_back_end/files/html/js/bootstrap4.min.js similarity index 100% rename from roles/web_support/files/html/js/bootstrap4.min.js rename to roles/www_back_end/files/html/js/bootstrap4.min.js diff --git a/roles/web_support/files/html/js/jquery.min.js b/roles/www_back_end/files/html/js/jquery.min.js similarity index 100% rename from roles/web_support/files/html/js/jquery.min.js rename to roles/www_back_end/files/html/js/jquery.min.js diff --git a/roles/web_support/files/html/services/power_off.php b/roles/www_back_end/files/html/services/power_off.php similarity index 100% rename from roles/web_support/files/html/services/power_off.php rename to roles/www_back_end/files/html/services/power_off.php diff --git a/roles/web_support/tasks/html.yml b/roles/www_back_end/tasks/html.yml similarity index 100% rename from roles/web_support/tasks/html.yml rename to roles/www_back_end/tasks/html.yml diff --git a/roles/web_support/tasks/main.yml b/roles/www_back_end/tasks/main.yml similarity index 69% rename from roles/web_support/tasks/main.yml rename to roles/www_back_end/tasks/main.yml index b75900b01..12741954f 100644 --- a/roles/web_support/tasks/main.yml +++ b/roles/www_back_end/tasks/main.yml @@ -1,10 +1,16 @@ +# Role "www_back_end" runs here, probably in 3-BASE-SERVER. +# Role "www_front_end" runs later, likely in 4-SERVER-OPTIONS. +# +# (Don't take either name too literally!) + + - include_tasks: html.yml - include_tasks: php-stem.yml # 2020-02-12: DOES THE FLAG BELOW (apache_high_php_limits) WORK WITH NGINX TOO? -# COMPARE apache_allow_sudo @ 4-server-options/tasks/main.yml +# COMPARE apache_allow_sudo @ roles/www_front_end/tasks/main.yml # For schools that use WordPress/Nextcloud/Moodle intensively. iiab/iiab#1147 # WARNING: Enabling this might cause excess use of RAM/disk or other resources! @@ -22,21 +28,13 @@ - { regexp: '^max_input_time', line: 'max_input_time = 300 ; default is 60' } -# 2020-02-12: *REQUIRED* by iiab-admin-console/roles/js-menu/tasks/main.yml, -# which should probably instead softcode iiab_home_url as set in local_vars.yml -# -# SEE httpd/tasks/install.yml for related 'a2ensite iiab-homepage.conf' -# -# (Both mkdir & iiab-homepage.conf stuff used to be in homepage/tasks/main.yml) -# -- name: Create dir {{ doc_root }}/home +- name: Create dir {{ doc_root }}/home -- if you customized var iiab_home_url e.g. in /etc/iiab/local_vars.yml, that dir is created later -- by www_front_end/tasks/main.yml file: state: directory path: "{{ doc_root }}/home" # /library/www/html owner: "{{ apache_user }}" group: "{{ apache_user }}" - mode: '0755' - + # mode: '0755' - name: Create dir {{ doc_root }}/info for http://box/info offline docs file: @@ -44,10 +42,23 @@ path: "{{ doc_root }}/info" # /library/www/html owner: "{{ apache_user }}" group: "{{ apache_user }}" - #mode: '0755' + # mode: '0755' - name: Install /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (Script can be run manually and/or at the end of Stage 4 = roles/4-server-options/tasks/main.yml) template: src: iiab-refresh-wiki-docs.sh dest: /usr/bin/iiab-refresh-wiki-docs mode: '0755' + + +# RECORD www_back_end AS INSTALLED + +- name: "Set 'www_back_end_installed: True'" + set_fact: + www_back_end_installed: True + +- name: "Add 'www_back_end_installed: True' to {{ iiab_state_file }}" + lineinfile: + path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + regexp: '^www_back_end_installed' + line: 'www_back_end_installed: True' diff --git a/roles/web_support/tasks/php-stem.yml b/roles/www_back_end/tasks/php-stem.yml similarity index 100% rename from roles/web_support/tasks/php-stem.yml rename to roles/www_back_end/tasks/php-stem.yml diff --git a/roles/web_support/templates/iiab-refresh-wiki-docs.sh b/roles/www_back_end/templates/iiab-refresh-wiki-docs.sh similarity index 100% rename from roles/web_support/templates/iiab-refresh-wiki-docs.sh rename to roles/www_back_end/templates/iiab-refresh-wiki-docs.sh diff --git a/roles/www_front_end/tasks/main.yml b/roles/www_front_end/tasks/main.yml new file mode 100644 index 000000000..f4525a861 --- /dev/null +++ b/roles/www_front_end/tasks/main.yml @@ -0,0 +1,61 @@ +# Role "www_back_end" runs earlier, likely in 3-BASE-SERVER. +# Role "www_front_end" runs here, probably in 4-SERVER-OPTIONS. +# +# (Don't take either name too literally!) + + +# HOMEPAGE + +- name: Create dir {{ doc_root }}{{ iiab_home_url }} just in case variable iiab_home_url was customized. (Standard path {{doc_root}}/home was created earlier.) + file: + state: directory + path: "{{ doc_root }}{{ iiab_home_url }}" # /library/www/html/home + owner: "{{ apache_user }}" + group: "{{ apache_user }}" + mode: '0755' + +- name: "IN CASE NGINX IS DISABLED: Enable IIAB pages via Apache (e.g. on port 80) if apache_install" + include_tasks: roles/httpd/tasks/homepage.yml + when: apache_install | bool + +- name: Enable IIAB pages via NGINX (e.g. on port 80) if nginx_install + include_tasks: roles/nginx/tasks/homepage.yml + when: nginx_install | bool + + +# 'Is a "Rapid Power Off" button possible for low-electricity environments?' +# gives more details here: http://FAQ.IIAB.IO + +# 2020-02-12: DOES THE FLAG BELOW (apache_allow_sudo) WORK WITH NGINX TOO ? +# COMPARE apache_high_php_limits @ roles/www_back_end/tasks/main.yml + +- name: Give {{ apache_user }} (per variable apache_user) permission to poweroff, installing /etc/sudoers.d/020_apache_poweroff from template + template: + src: 020_apache_poweroff.j2 + dest: /etc/sudoers.d/020_apache_poweroff + mode: '0755' + when: apache_allow_sudo | bool + +- name: Remove {{ apache_user }} (per variable apache_user) permission to poweroff, removing /etc/sudoers.d/020_apache_poweroff + file: + path: /etc/sudoers.d/020_apache_poweroff + state: absent + when: not apache_allow_sudo + + +- name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (This script was installed in Stage 3 = roles/3-base-server/tasks/main.yml, which ran roles/www_back_end/tasks/main.yml) + command: /usr/bin/iiab-refresh-wiki-docs + when: internet_available and not nodocs + + +# RECORD www_front_end AS INSTALLED + +- name: "Set 'www_front_end_installed: True'" + set_fact: + www_front_end_installed: True + +- name: "Add 'www_front_end_installed: True' to {{ iiab_state_file }}" + lineinfile: + path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + regexp: '^www_front_end_installed' + line: 'www_front_end_installed: True' diff --git a/roles/web_support/templates/020_apache_poweroff.j2 b/roles/www_front_end/templates/020_apache_poweroff.j2 similarity index 100% rename from roles/web_support/templates/020_apache_poweroff.j2 rename to roles/www_front_end/templates/020_apache_poweroff.j2 diff --git a/tests/test.yml b/tests/test.yml index dae66056b..a79a8d2e1 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -72,8 +72,9 @@ - { role: transmission } - { role: usb_lib } - { role: vnstat } - - { role: web_support } - { role: wordpress } + - { role: www_back_end } + - { role: www_front_end } - { role: yarn } #- { roles: xovis }