mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #335 from jvonau/shims
Refine @jvonau's "Move nginx shims to roles" #2131 (WIP)
This commit is contained in:
commit
ef93b30370
12 changed files with 118 additions and 42 deletions
|
@ -11,11 +11,25 @@
|
|||
state: absent
|
||||
when: not dokuwiki_enabled and is_debuntu
|
||||
|
||||
- name: Install {{ nginx_config_dir }}/dokuwiki-nginx.conf SHIM from template
|
||||
template:
|
||||
src: dokuwiki-nginx.conf
|
||||
dest: "{{ nginx_config_dir }}/dokuwiki-nginx.conf"
|
||||
when: dokuwiki_enabled and nginx_enabled
|
||||
|
||||
- name: Restart Apache ({{ apache_service }}) to enable/disable DokuWiki's http://box/wiki
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
when: apache_enabled
|
||||
|
||||
- name: Restart nginx to enable/disable DokuWiki's http://box/wiki
|
||||
systemd:
|
||||
name: nginx
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
when: nginx_enabled
|
||||
|
||||
- name: Add 'dokuwiki' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
|
|
3
roles/dokuwiki/templates/dokuwiki-nginx.conf
Normal file
3
roles/dokuwiki/templates/dokuwiki-nginx.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
location {{ dokuwiki_url }} {
|
||||
proxy_pass http://127.0.0.1:{{ apache_port }}{{ dokuwiki_url }};
|
||||
}
|
|
@ -17,10 +17,25 @@
|
|||
state: absent
|
||||
when: not elgg_enabled and is_redhat
|
||||
|
||||
- name: Install {{ nginx_config_dir }}/elgg-nginx.conf from template
|
||||
template:
|
||||
src: elgg-nginx.conf
|
||||
dest: "{{ nginx_config_dir }}/elgg-nginx.conf"
|
||||
when: elgg_enabled and nginx_enabled
|
||||
|
||||
- name: Restart Apache ({{ apache_service }}) to enable/disable http://box/elgg
|
||||
service:
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
when: apache_enabled
|
||||
|
||||
- name: Restart nginx to enable/disable http://box/elgg
|
||||
systemd:
|
||||
name: nginx
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
when: nginx_enabled
|
||||
|
||||
- name: Add 'elgg' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
name: lokole
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: lokole_enabled | bool
|
||||
when: lokole_enabled
|
||||
|
||||
- name: Disable 'lokole' service, if not lokole_enabled
|
||||
systemd:
|
||||
|
@ -38,11 +38,25 @@
|
|||
state: absent
|
||||
when: (not lokole_enabled) and (not is_debuntu)
|
||||
|
||||
- name: Install {{ nginx_config_dir }}/lokole-nginx.conf from template
|
||||
template:
|
||||
src: lokole-nginx.conf.j2
|
||||
dest: "{{ nginx_config_dir }}/lokole-nginx.conf"
|
||||
when: lokole_enabled and nginx_enabled
|
||||
|
||||
- name: Restart Apache ({{ apache_service }}) to enable/disable http://box/lokole
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: "{{ apache_service }}"
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
when: apache_enabled
|
||||
|
||||
- name: Restart nginx to enable/disable http://box/lokole
|
||||
systemd:
|
||||
name: nginx
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
when: nginx_enabled
|
||||
|
||||
- name: Add 'lokole' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
|
|
|
@ -23,11 +23,25 @@
|
|||
state: absent
|
||||
when: not nextcloud_enabled and is_redhat
|
||||
|
||||
- name: Install Nextcloud's nginx conf.d file from template
|
||||
template:
|
||||
src: nextcloud-nginx.conf
|
||||
dest: "{{ nginx_config_dir }}/nextcloud-nginx.conf"
|
||||
when: nextcloud_enabled and nginx_enabled
|
||||
|
||||
- name: Restart {{ apache_service }}, enabling/disabling http://box/nextcloud
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
daemon-reload: yes
|
||||
state: restarted
|
||||
when: apache_enabled | bool
|
||||
|
||||
- name: Restart nginx enabling/disabling http://box/nextcloud
|
||||
systemd:
|
||||
name: nginx
|
||||
daemon-reload: yes
|
||||
state: restarted
|
||||
when: nginx_enabled
|
||||
|
||||
- name: Add 'nextcloud' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
- name: "Install from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf, {{ nginx_config_dir }}/iiab.conf"
|
||||
template:
|
||||
src: "{{ item.src}}"
|
||||
dest: "{{ item.dest }}"
|
||||
with_items:
|
||||
- { src: "server.conf", dest: "/etc/nginx/" }
|
||||
- { src: "nginx.conf", dest: "/etc/nginx/" }
|
||||
- { src: "ports.conf", dest: "/etc/{{ apache_service }}/" }
|
||||
- { src: "iiab.conf.j2", dest: "{{ nginx_config_dir }}/iiab.conf" }
|
||||
when: nginx_enabled | bool
|
||||
|
||||
- name: Remove stale files (usb-lib.conf, modules.conf) from {{ nginx_config_dir }}
|
||||
file:
|
||||
state: absent
|
||||
|
@ -22,19 +11,29 @@
|
|||
name: "{{ apache_service }}"
|
||||
state: stopped
|
||||
|
||||
- name: "Install from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf, {{ nginx_config_dir }}/iiab.conf"
|
||||
template:
|
||||
src: "{{ item.src}}"
|
||||
dest: "{{ item.dest }}"
|
||||
with_items:
|
||||
- { src: "server.conf", dest: "/etc/nginx/" }
|
||||
- { src: "nginx.conf", dest: "/etc/nginx/" }
|
||||
- { src: "ports.conf", dest: "/etc/{{ apache_service }}/" }
|
||||
- { src: "iiab.conf.j2", dest: "{{ nginx_config_dir }}/iiab.conf" }
|
||||
when: nginx_enabled | bool
|
||||
|
||||
# the below slides in nginx's proxypass config files for apache on localhost
|
||||
# via the ports.conf file installed above
|
||||
- name: Install proxpass to Apache running on localhost port {{ apache_port }}
|
||||
include_tasks: uses_apache.yml
|
||||
when: nginx_enabled | bool
|
||||
#- name: Install proxpass to apache running on localhost port {{ apache_port }}
|
||||
# include_tasks: uses_apache.yml
|
||||
# when: apache_enabled
|
||||
|
||||
# the below task contains the same logic contained in the playbooks to enable
|
||||
# 'runrole nginx' to do the right thing but with the 'src' path set to role's
|
||||
# templates path ie roles/<rolename>/template/
|
||||
|
||||
- name: Install proxpass to other services 'dual mode' roles
|
||||
include_tasks: only_nginx.yml
|
||||
when: nginx_enabled | bool
|
||||
#- name: Install proxpass to other services 'dual mode' roles
|
||||
# include_tasks: only_nginx.yml
|
||||
# when: nginx_enabled
|
||||
|
||||
- name: Stop and disable NGINX when not nginx_enabled
|
||||
systemd:
|
||||
|
@ -50,9 +49,9 @@
|
|||
when: not nginx_enabled
|
||||
|
||||
# should have the logic to handle both modes in the playbook
|
||||
- name: Enable Apache (a2ensite) for 'dual mode' for the role when NGINX is disabled
|
||||
include_tasks: disable.yml
|
||||
when: not nginx_enabled
|
||||
#- name: Enable Apache (a2ensite) for 'dual mode' for the role when NGINX is diabled
|
||||
# include_tasks: disable.yml
|
||||
# when: not nginx_enabled
|
||||
|
||||
- name: Enable & Restart Apache, since we stopped it ({{ apache_service }})
|
||||
systemd:
|
||||
|
@ -60,7 +59,7 @@
|
|||
daemon_reload: yes
|
||||
state: restarted
|
||||
enabled: true
|
||||
when: apache_enabled | bool
|
||||
when: apache_enabled | bool or not nginx_enabled | bool
|
||||
|
||||
- name: Enable & Restart NGINX, to pick up the config files installed
|
||||
systemd:
|
||||
|
|
|
@ -1,25 +1,10 @@
|
|||
- name: Create symlink nodered.conf from sites-enabled to sites-available, for short URL http://box/nodered (if nodered_enabled)
|
||||
file:
|
||||
src: /etc/apache2/sites-available/nodered.conf
|
||||
dest: /etc/apache2/sites-enabled/nodered.conf
|
||||
owner: root
|
||||
group: root
|
||||
state: link
|
||||
when: nodered_enabled | bool
|
||||
|
||||
- name: Remove symlink /etc/apache2/sites-enabled/nodered.conf (if not nodered_enabled)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/nodered.conf
|
||||
state: absent
|
||||
when: not nodered_enabled
|
||||
|
||||
- name: Enable & (Re)start 'nodered' systemd service (if nodered_enabled)
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: nodered
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: nodered_enabled | bool
|
||||
when: nodered_enabled
|
||||
|
||||
- name: Disable & Stop 'nodered' systemd service (if not nodered_enabled)
|
||||
systemd:
|
||||
|
@ -29,11 +14,43 @@
|
|||
state: stopped
|
||||
when: not nodered_enabled
|
||||
|
||||
- name: Create symlink nodered.conf from sites-enabled to sites-available, for short URL http://box/nodered (if nodered_enabled)
|
||||
file:
|
||||
src: /etc/apache2/sites-available/nodered.conf
|
||||
dest: /etc/apache2/sites-enabled/nodered.conf
|
||||
owner: root
|
||||
group: root
|
||||
state: link
|
||||
when: nodered_enabled
|
||||
|
||||
- name: Remove symlink /etc/apache2/sites-enabled/nodered.conf (if not nodered_enabled)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/nodered.conf
|
||||
state: absent
|
||||
when: not nodered_enabled
|
||||
|
||||
- name: Install NodeRed's nginx conf.d file from template
|
||||
template:
|
||||
src: nodered-nginx.conf.j2
|
||||
dest: "{{ nginx_config_dir }}/nodered-nginx.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0666
|
||||
when: nodered_enabled and nginx_enabled
|
||||
|
||||
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/nodered (not just http://box:{{ nodered_port }}/nodered)
|
||||
systemd:
|
||||
name: "{{ apache_service }}" # httpd or apache2
|
||||
daemon-reload: yes
|
||||
state: restarted
|
||||
when: nodered_install | bool
|
||||
when: apache_enabled
|
||||
|
||||
- name: Restart nginx to enable/disable http://box/nodered (not just http://box:{{ nodered_port }}/nodered)
|
||||
systemd:
|
||||
name: nginx
|
||||
state: restarted
|
||||
daemon-reload: yes
|
||||
when: nginx_enabled
|
||||
|
||||
- name: Add 'nodered' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue