diff --git a/roles/0-DEPRECATED-ROLES/homepage/tasks/main.yml b/roles/0-DEPRECATED-ROLES/homepage/tasks/main.yml new file mode 100644 index 000000000..10203e4cd --- /dev/null +++ b/roles/0-DEPRECATED-ROLES/homepage/tasks/main.yml @@ -0,0 +1,21 @@ +- name: Create dir {{ doc_root }}/home + file: + state: directory + path: "{{ doc_root }}/home" # /library/www/html + owner: "{{ apache_user }}" + group: "{{ apache_user }}" + mode: '0755' + +- 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: Symlink /etc/apache2/sites-enabled/iiab-homepage.conf to /etc/{{ apache_conf_dir }}/iiab-homepage.conf (debuntu) +- name: Enable iiab-homepage.conf via Apache + command: a2ensite: iiab-homepage.conf + # file: + # src: "/etc/{{ apache_conf_dir }}/iiab-homepage.conf" + # path: /etc/apache2/sites-enabled/iiab-homepage.conf + # state: link + # when: is_debuntu | bool diff --git a/roles/homepage/templates/iiab-homepage.conf b/roles/0-DEPRECATED-ROLES/homepage/templates/iiab-homepage.conf similarity index 100% rename from roles/homepage/templates/iiab-homepage.conf rename to roles/0-DEPRECATED-ROLES/homepage/templates/iiab-homepage.conf diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index 4c4b0fff9..715d59b1c 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -11,7 +11,6 @@ - name: WEB_SUPPORT include_role: name: web_support - #when: web_support_install | bool when: apache_install or nginx_install - name: HTTPD (Apache) diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index c72b27065..ebe33c7ab 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -27,12 +27,10 @@ name: usb_lib when: usb_lib_install | bool -# This is in Stage 4-SERVER-OPTIONS (rather than 3-BASE-SERVER) because var -# iiab_home_url changes, and may need to be re-run in the field/offline/etc. -- name: HOMEPAGE under Apache - include_role: - name: homepage - when: not nginx_enabled +# 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: diff --git a/roles/homepage/tasks/main.yml b/roles/homepage/tasks/main.yml deleted file mode 100644 index d54a806ee..000000000 --- a/roles/homepage/tasks/main.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: Create dir {{ doc_root }}/home - file: - path: "{{ doc_root }}/home" - owner: "{{ apache_user }}" - group: "{{ apache_user }}" - mode: 0755 - state: directory - -- 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: Symlink /etc/apache2/sites-enabled/iiab-homepage.conf to /etc/{{ apache_conf_dir }}/iiab-homepage.conf (debuntu) - file: - src: "/etc/{{ apache_conf_dir }}/iiab-homepage.conf" - path: /etc/apache2/sites-enabled/iiab-homepage.conf - state: link - when: is_debuntu | bool diff --git a/roles/httpd/tasks/install.yml b/roles/httpd/tasks/install.yml index df3998db9..076488a85 100644 --- a/roles/httpd/tasks/install.yml +++ b/roles/httpd/tasks/install.yml @@ -147,6 +147,35 @@ - { src: 'roles/httpd/templates/010-iiab.conf.j2', dest: '/etc/{{ apache_conf_dir }}/010-iiab.conf' } - { src: 'roles/httpd/templates/proxy_ajp.conf.j2', dest: '/etc/{{ apache_conf_dir }}/proxy_ajp.conf' } +- 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 pages via Apache (e.g. on port 80) by running 'a2ensite 010-iiab.conf'" + command: a2ensite 010-iiab.conf + #when: apache_enabled | bool + +# - name: Disable IIAB pages via Apache (e.g. on port 80) by running 'a2dissite 010-iiab.conf', if not apache_enabled" +# 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 roles/web_support 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: "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 + # - name: Enable & Stop '{{ apache_service }}' systemd service # systemd: # name: "{{ apache_service }}" diff --git a/roles/httpd/tasks/main.yml b/roles/httpd/tasks/main.yml index 266ab1693..85795c048 100644 --- a/roles/httpd/tasks/main.yml +++ b/roles/httpd/tasks/main.yml @@ -42,14 +42,6 @@ when: apache_installed is undefined -- name: "IN CASE NGINX IS DISABLED: Enable IIAB pages via Apache (e.g. on port 80) by running 'a2ensite 010-iiab.conf', if apache_enabled" - command: a2ensite 010-iiab.conf - when: apache_enabled | bool - -- name: Disable IIAB pages via Apache (e.g. on port 80) by running 'a2dissite 010-iiab.conf', if not apache_enabled" - command: a2dissite 010-iiab.conf - when: not apache_enabled - - name: Enable & (Re)Start {{ apache_service }} systemd service, if apache_enabled systemd: name: "{{ apache_service }}" diff --git a/roles/httpd/templates/iiab-homepage.conf b/roles/httpd/templates/iiab-homepage.conf new file mode 100644 index 000000000..0fc7a8e2e --- /dev/null +++ b/roles/httpd/templates/iiab-homepage.conf @@ -0,0 +1,9 @@ +# IIAB Home Page + +# Redirect to home page on School Server +# Default [was] xs-portal [and is now generally] home + +# RedirectMatch of root to homepage +# See the note in default_vars.yml + +RedirectMatch ^/$ {{ iiab_home_url }} diff --git a/roles/web_support/tasks/main.yml b/roles/web_support/tasks/main.yml index d6accbdc9..4594125bf 100644 --- a/roles/web_support/tasks/main.yml +++ b/roles/web_support/tasks/main.yml @@ -21,6 +21,17 @@ - { 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 +- name: Create dir {{ doc_root }}/home + file: + state: directory + path: "{{ doc_root }}/home" # /library/www/html + owner: "{{ apache_user }}" + group: "{{ apache_user }}" + mode: '0755' + + - name: Create dir {{ doc_root }}/info for http://box/info offline docs file: state: directory