1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Reduce Apache dependency in usb_lib & nginx roles

This commit is contained in:
root 2020-05-17 01:06:48 -04:00
parent 333feadba0
commit b1fcec30fe
6 changed files with 39 additions and 23 deletions

View file

@ -41,10 +41,9 @@
name: samba name: samba
when: samba_install | bool when: samba_install | bool
# 2020-02-12: what was roles/homepage lives in roles/www_base & # 2020-20-17: what was roles/homepage lives in roles/www_options. Eventually
# roles/www_options for now. Eventually softcoding of iiab_home_url # softcoding of iiab_home_url should happen everywhere (incl Admin Console) for
# should happen everywhere (incl Admin Console) to allow more field # more field options, e.g. changing /library/www/html/home even when offline...
# options, e.g. changing /library/www/html/home even when offline...
- name: WWW_OPTIONS (WWW_BASE should have been installed earlier) - name: WWW_OPTIONS (WWW_BASE should have been installed earlier)
include_role: include_role:

View file

@ -2,7 +2,8 @@
systemd: systemd:
name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml
state: stopped state: stopped
when: apache_installed is defined ignore_errors: yes
# 'when: apache_installed is defined' insuff b/c mysql's php installs apache2
- 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 - 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: template:

View file

@ -1,19 +1,20 @@
# This stanza can likely be removed later in 2020: # This stanza can likely be removed later in 2020:
- name: 'Remove legacy files if present: /etc/systemd/system/uwsgi.service, {{ nginx_conf_dir }}/usb-lib.conf, {{ nginx_conf_dir }}/modules.conf' #
file: # - name: 'Remove legacy files if present: /etc/systemd/system/uwsgi.service, {{ nginx_conf_dir }}/usb-lib.conf, {{ nginx_conf_dir }}/modules.conf'
path: "{{ item.path }}" # file:
state: absent # path: "{{ item.path }}"
with_items: # state: absent
- { path: "/etc/systemd/system/uwsgi.service" } # with_items:
- { path: "{{ nginx_conf_dir }}/usb-lib.conf" } # - { path: "/etc/systemd/system/uwsgi.service" }
- { path: "{{ nginx_conf_dir }}/modules.conf" } # - { path: "{{ nginx_conf_dir }}/usb-lib.conf" }
# - { path: "{{ nginx_conf_dir }}/modules.conf" }
- name: Stop '{{ apache_service }}' systemd service - name: Stop '{{ apache_service }}' systemd service
systemd: systemd:
name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml
state: stopped state: stopped
when: apache_installed is defined ignore_errors: yes
#ignore_errors: yes # 'when: apache_installed is defined' insuff b/c mysql's php installs apache2
- name: Install required and helper packages for NGINX - name: Install required and helper packages for NGINX
package: package:

View file

@ -0,0 +1,12 @@
- name: Enable http://box/usb via Apache
command: a2ensite content_dir.conf
when: usb_lib_enabled | bool
- name: Disable http://box/usb via Apache
command: a2dissite content_dir.conf
when: not usb_lib_enabled
- name: (Re)Start '{{ apache_service }}' systemd service
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted

View file

@ -30,7 +30,13 @@
when: usb_lib_installed is undefined when: usb_lib_installed is undefined
- include_tasks: enable-or-disable.yml - name: Enable/Disable/Restart Apache if primary
include_tasks: apache.yml
when: not nginx_enabled
- name: Enable/Disable/Restart NGINX if primary
include_tasks: nginx.yml
when: nginx_enabled | bool
- name: Put variable in iiab.env that enables display of content at root of USB - name: Put variable in iiab.env that enables display of content at root of USB

View file

@ -28,10 +28,7 @@
state: absent state: absent
when: not usb_lib_enabled when: not usb_lib_enabled
- name: Enable http://box/usb via Apache, if usb_lib_enabled - name: Restart 'nginx' systemd service
command: a2ensite content_dir.conf systemd:
when: apache_install and usb_lib_enabled name: nginx
state: restarted
- name: Disable http://box/usb via Apache, if not usb_lib_enabled
command: a2dissite content_dir.conf
when: apache_install and not usb_lib_enabled