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:
parent
333feadba0
commit
b1fcec30fe
6 changed files with 39 additions and 23 deletions
|
@ -41,10 +41,9 @@
|
|||
name: samba
|
||||
when: samba_install | bool
|
||||
|
||||
# 2020-02-12: what was roles/homepage lives in roles/www_base &
|
||||
# roles/www_options 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...
|
||||
# 2020-20-17: what was roles/homepage lives in roles/www_options. Eventually
|
||||
# softcoding of iiab_home_url should happen everywhere (incl Admin Console) for
|
||||
# more field options, e.g. changing /library/www/html/home even when offline...
|
||||
|
||||
- name: WWW_OPTIONS (WWW_BASE should have been installed earlier)
|
||||
include_role:
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
systemd:
|
||||
name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml
|
||||
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
|
||||
template:
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
# 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:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- { path: "/etc/systemd/system/uwsgi.service" }
|
||||
- { path: "{{ nginx_conf_dir }}/usb-lib.conf" }
|
||||
- { path: "{{ nginx_conf_dir }}/modules.conf" }
|
||||
#
|
||||
# - name: 'Remove legacy files if present: /etc/systemd/system/uwsgi.service, {{ nginx_conf_dir }}/usb-lib.conf, {{ nginx_conf_dir }}/modules.conf'
|
||||
# file:
|
||||
# path: "{{ item.path }}"
|
||||
# state: absent
|
||||
# with_items:
|
||||
# - { path: "/etc/systemd/system/uwsgi.service" }
|
||||
# - { path: "{{ nginx_conf_dir }}/usb-lib.conf" }
|
||||
# - { path: "{{ nginx_conf_dir }}/modules.conf" }
|
||||
|
||||
- name: Stop '{{ apache_service }}' systemd service
|
||||
systemd:
|
||||
name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml
|
||||
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
|
||||
package:
|
||||
|
|
12
roles/usb_lib/tasks/apache.yml
Normal file
12
roles/usb_lib/tasks/apache.yml
Normal 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
|
|
@ -30,7 +30,13 @@
|
|||
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
|
||||
|
|
|
@ -28,10 +28,7 @@
|
|||
state: absent
|
||||
when: not usb_lib_enabled
|
||||
|
||||
- name: Enable http://box/usb via Apache, if usb_lib_enabled
|
||||
command: a2ensite content_dir.conf
|
||||
when: apache_install and usb_lib_enabled
|
||||
|
||||
- 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
|
||||
- name: Restart 'nginx' systemd service
|
||||
systemd:
|
||||
name: nginx
|
||||
state: restarted
|
Loading…
Add table
Reference in a new issue