1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #328 from jvonau/softcode

sync from jvonau:softcode
This commit is contained in:
A Holt 2020-01-10 16:59:40 -05:00 committed by GitHub
commit 3f6c897ba1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 135 additions and 99 deletions

View file

@ -19,13 +19,13 @@
group: root
mode: 0644
with_items:
- { src: "awstats-nginx.conf", dest: "/etc/nginx/conf.d/" }
- { src: "awstats-nginx.conf", dest: "{{ nginx_config_dir }}/" }
- { src: "cgi-bin.php", dest: "/etc/nginx/" }
when: awstats_enabled and nginx_enabled
- name: Remove /etc/nginx/conf.d/awstats-nginx.conf
- name: Remove {{ nginx_config_dir }}/awstats-nginx.conf
file:
path: /etc/nginx/conf.d/awstats-nginx.conf
path: "{{ nginx_config_dir }}/awstats-nginx.conf"
state: absent
when: not awstats_enabled

View file

@ -44,8 +44,6 @@
group: root
mode: 0644
with_items:
# - { src: "awstats-nginx.conf", dest: "/etc/nginx/conf.d/" }
# - { src: "cgi-bin.php", dest: "/etc/nginx/" }
- { src: "apache-awstats.conf", dest: "/etc/{{ apache_config_dir }}/awstats.conf" }
when: awstats_enabled and is_debuntu

View file

@ -4,17 +4,7 @@
daemon_reload: yes
enabled: yes
state: restarted
when: calibreweb_enabled | bool
# Default: http://box/books
# SEE ALSO: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy
- name: Enable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2ensite calibre-web.conf
when: calibreweb_enabled | bool
#- name: Restart Apache after enabling calibre-web httpd2 site
# command: apachectl -k graceful
# when: calibreweb_enabled | bool
when: calibreweb_enabled
- name: Disable 'calibre-web' systemd service
systemd:
@ -24,15 +14,17 @@
state: stopped
when: not calibreweb_enabled
# Default: http://box/books
# SEE ALSO: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy
- name: Enable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2ensite calibre-web.conf
when: calibreweb_enabled and not nginx_enabled
- name: Disable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2dissite calibre-web.conf
when: not calibreweb_enabled or nginx_enabled | bool
when: not calibreweb_enabled or nginx_enabled | bool and apache_install
#- name: Restart Apache after disabling calibre-web httpd2 site
# command: apachectl -k graceful
# when: not calibreweb_enabled
- name: Install /etc/nginx/conf.d/calibre-web-nginx.conf
- name: Install {{ nginx_config_dir }}/calibre-web-nginx.conf
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
@ -40,20 +32,26 @@
owner: root
group: root
with_items:
- { src: 'calibre-web-nginx.conf.j2', dest: '/etc/nginx/conf.d/calibre-web-nginx.conf', mode: '0644' }
when: calibreweb_enabled | bool and nginx_enabled | bool
- { src: 'calibre-web-nginx.conf.j2', dest: '{{ nginx_config_dir }}/calibre-web-nginx.conf', mode: '0644' }
when: calibreweb_enabled and nginx_enabled
- name: Remove {{ nginx_config_dir }}/calibre-web-nginx.conf
file:
path: {{ nginx_config_dir }}/calibre-web-nginx.conf
state: absent
when: not calibreweb_enabled and nginx_enabled
- name: Restart nginx systemd service
systemd:
name: nginx
state: restarted
when: calibreweb_enabled | bool and nginx_enabled | bool
when: calibreweb_enabled and nginx_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # httpd or apache2
state: restarted
when: not nginx_enabled | bool
when: not nginx_enabled
- name: Add 'calibre-web' variable values to {{ iiab_ini_file }}
ini_file:

View file

@ -26,7 +26,7 @@
src: /etc/{{ apache_config_dir }}/gitea.conf
dest: /etc/apache2/sites-enabled/gitea.conf
state: link
when: gitea_enabled and is_debuntu
when: gitea_enabled and not nginx_enabled
- name: Remove apache httpd conf file (OS's other than debuntu)
file:
@ -36,21 +36,19 @@
- name: Remove nginx httpd conf file
file:
path: /etc/nginx/conf.d/gitea-nginx.conf
path: "{{ nginx_config_dir }}/gitea-nginx.conf"
state: absent
when: not gitea_enabled
- name: Enable nginx httpd conf file
template:
src: gitea-nginx.conf.j2
dest: /etc/nginx/conf.d/gitea-nginx.conf
dest: "{{ nginx_config_dir }}/gitea-nginx.conf"
when: gitea_enabled and nginx_enabled
- name: >-
Restart Apache ({{ apache_service }}) to {% if gitea_enabled %}enable{%
else %}disable{% endif %} http://box/gitea
- name: Restart nginx
systemd:
name: "{{ apache_service }}"
name: nginx
daemon_reload: yes
state: restarted

View file

@ -3,7 +3,7 @@
src: /etc/apache2/sites-available/kiwix.conf
path: /etc/apache2/sites-enabled/kiwix.conf
state: link
when: kiwix_enabled | bool and not nginx_enabled | bool
when: kiwix_enabled and not nginx_enabled
- name: Install nginx support
template:
@ -14,14 +14,20 @@
group: root
mode: "{{ item.mode }}"
with_items:
- { src: 'kiwix-nginx.conf', dest: '/etc/nginx/conf.d/kiwix-nginx.conf', mode: '0644' }
when: kiwix_enabled | bool and nginx_enabled | bool
- { src: 'kiwix-nginx.conf', dest: '{{ nginx_config_dir }}/kiwix-nginx.conf', mode: '0644' }
when: kiwix_enabled and nginx_enabled
- name: Remove symlink /etc/apache2/sites-enabled/kiwix.conf
file:
path: /etc/apache2/sites-enabled/kiwix.conf
state: absent
when: not kiwix_enabled | bool or nginx_enabled | bool
when: not kiwix_enabled or nginx_enabled
- name: Remove {{ nginx_config_dir }}/kiwix-nginx.conf
file:
path: "{{ nginx_config_dir }}/kiwix-nginx.conf"
state: absent
when: not kiwix_enabled and nginx_enabled
- name: Enable & Restart 'kiwix-serve' service
systemd:
@ -29,7 +35,7 @@
name: kiwix-serve
enabled: yes
state: restarted
when: kiwix_enabled | bool
when: kiwix_enabled
- name: Disable 'kiwix-serve' service
systemd:
@ -59,9 +65,19 @@
when: kiwix_enabled and is_redhat
- name: Restart Apache, so it picks up kiwix.conf
service:
systemd:
name: "{{ apache_service }}"
state: restarted
daemon-reload: yes
when: not nginx_enabled
- name: Restart nginx service
systemd:
name: nginx
state: restarted
daemon-reload: yes
when: nginx_enabled
# 5. FINALIZE

View file

@ -3,11 +3,7 @@
name: kolibri
state: started
enabled: yes
when: kolibri_enabled | bool
- name: Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri
command: a2ensite kolibri.conf
when: kolibri_enabled | bool and not nginx_enabled | bool
when: kolibri_enabled
- name: Disable & Stop 'kolibri' systemd service if not kolibri_enabled
systemd:
@ -16,11 +12,15 @@
state: stopped
when: not kolibri_enabled
- name: Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri
command: a2ensite kolibri.conf
when: kolibri_enabled and not nginx_enabled
- name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled
command: a2dissite kolibri.conf
when: not kolibri_enabled or nginx_enabled | bool
when: not kolibri_enabled or nginx_enabled
- name: Supply /etc/nginx/conf.d/kolibri-nginx.conf when nginx_enabled
- name: Supply {{ nginx_config_dir }}/kolibri-nginx.conf when nginx_enabled
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
@ -28,24 +28,26 @@
owner: root
group: root
with_items:
- { src: 'kolibri-nginx.conf.j2', dest: '/etc/nginx/conf.d/kolibri-nginx.conf', mode: '0644' }
when: kolibri_enabled | bool and nginx_enabled | bool
- { src: 'kolibri-nginx.conf.j2', dest: '{{ nginx_config_dir }}/kolibri-nginx.conf', mode: '0644' }
when: kolibri_enabled and nginx_enabled
- name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled
command: a2dissite kolibri.conf
when: not kolibri_enabled or nginx_enabled | bool
- name: Remove {{ nginx_config_dir }}/kolibri-nginx.conf when not nginx_enabled
file:
path: "{{ nginx_config_dir }}/kolibri-nginx.conf"
state: absent
when: not kolibri_enabled and nginx_enabled
- name: Restart Apache service ({{ apache_service }}) # e.g. apache2
systemd:
name: "{{ apache_service }}"
state: restarted
when: not nginx_enabled | bool
when: not nginx_enabled
- name: Restart nginx service
systemd:
name: nginx
state: restarted
when: nginx_enabled | bool
when: nginx_enabled
- name: Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini
ini_file:

View file

@ -3,12 +3,24 @@
src: /etc/apache2/sites-available/mediawiki.conf
dest: /etc/apache2/sites-enabled/mediawiki.conf
state: link
when: mediawiki_enabled and is_debuntu
when: mediawiki_enabled and not nginx_enabled
- name: Remove mediawiki.conf if not mediawiki_enabled (debuntu)
file:
path: /etc/apache2/sites-enabled/mediawiki.conf
state: absent
when: not mediawiki_enabled or nginx_enabled
- name: Install {{ nginx_config_dir }}/mediawiki-nginx.conf from template, for http://box{{ mediawiki_url }}
template:
src: mediawiki-nginx.conf.j2
dest: "{{ nginx_config_dir }}/mediawiki-nginx.conf"
when: mediawiki_enabled and nginx_enabled
- name: Remove mediawiki-nginx.conf if not mediawiki_enabled (debuntu)
file:
path: "{{ nginx_config_dir }}/mediawiki-nginx.conf"
state: absent
when: not mediawiki_enabled and is_debuntu
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box{{ mediawiki_url }}
@ -16,24 +28,14 @@
name: "{{ apache_service }}"
daemon_reload: yes
state: restarted
- name: Install {{ nginx_config_dir }}/mediawiki-nginx.conf from template, for http://box{{ mediawiki_url }}
template:
src: mediawiki-nginx.conf.j2
dest: "{{ nginx_config_dir }}/mediawiki-nginx.conf"
when: mediawiki_enabled
- name: Remove mediawiki-nginx.conf if not mediawiki_enabled (debuntu)
file:
path: "{{ nginx_config_dir }}/mediawiki-nginx.conf"
state: absent
when: not mediawiki_enabled and is_debuntu
when: mediawiki_enabled and not nginx_enabled
- name: Restart nginx service to enable/disable http://box{{ mediawiki_url }}
systemd:
name: nginx
daemon_reload: yes
state: restarted
when: nginx_enabled
- name: Add 'mediawiki' variable values to {{ iiab_ini_file }}
ini_file:

View file

@ -4,21 +4,24 @@
3. Current state (10/16/19)
1. Principal functions migrated to nginx.
* Admin Console
* Awstats
* kalite -- goes directly to port 8009
* usb-lib
* maps
* usb-lib
2. Dual support
* kiwix -- goes directly to port 3000
* Awstats
* calibre-web
* gitea
* kiwix -- goes directly to port 3000
* kolibri
* sugarizer
3. Still proxied to Apache
* mediawiki
* sugarizer
* wordpress
3. Still proxied to Apache
* dokuwiki
* elgg
* lokole
* moodle
* nodered
* nextcloud
* wordpress
* moodle
4. Not dealt with yet
* archive.org

View file

@ -6,7 +6,7 @@
- { src: "server.conf",dest: "/etc/nginx/" }
- { src: "nginx.conf",dest: "/etc/nginx/" }
- { src: "ports.conf" , dest: "/etc/{{ apache_service }}/" }
- { src: "iiab.conf.j2",dest: "/etc/nginx/conf.d/iiab.conf" }
- { src: "iiab.conf.j2",dest: "{{ nginx_config_dir }}/iiab.conf" }
when: nginx_enabled
- name: Clean stale config files
@ -14,8 +14,8 @@
state: absent
path: '{{ item.path }}'
with_items:
- { path: "/etc/nginx/conf.d/usb-lib.conf" }
- { path: "/etc/nginx/conf.d/modules.conf" }
- { path: "{{ nginx_config_dir }}/usb-lib.conf" }
- { path: "{{ nginx_config_dir }}/modules.conf" }
- name: Insure that apache2 is not running -- we may need port swap
systemd:

View file

@ -1,3 +1,3 @@
location {{ dokuwiki_url }} {
proxy_pass http://127.0.0.1:{{ apache_port }}/{{ dokuwiki_url }};
proxy_pass http://127.0.0.1:{{ apache_port }}{{ dokuwiki_url }};
}

View file

@ -10,7 +10,7 @@ server {
index index.php index.html index.htm;
# let individual services drop location blocks in conf.d
include /etc/nginx/conf.d/*;
include {{ nginx_config_dir }}/*;
location ~ .*\.php$ {
proxy_set_header X-Real-IP $remote_addr;

View file

@ -69,17 +69,17 @@
src: map_functions.js
dest: '{{ vector_map_path }}/maplist/assets'
- name: Install /etc/nginx/conf.d/osm-vector-maps.conf from template
- name: Install {{ nginx_config_dir }}/osm-vector-maps.conf from template
template:
src: osm-vector-maps-nginx.conf
dest: "/etc/nginx/conf.d/osm-vector-maps-nginx.conf"
when: osm_vector_maps_enabled | bool
dest: "{{ nginx_config_dir }}/osm-vector-maps-nginx.conf"
when: osm_vector_maps_enabled
- name: Remove config /etc/nginx/conf,d/osm-vector-maps.conf (debuntu)
- name: Remove {{ nginx_config_dir }}/osm-vector-maps.conf (debuntu)
file:
path: /etc/nginx/conf.d/osm-vector-maps-nginx.conf
path: "{{ nginx_config_dir }}/osm-vector-maps-nginx.conf"
state: absent
when: not osm_vector_maps_enabled | bool
when: not osm_vector_maps_enabled
#- name: Does the {{ vector_map_path }}/index.html redirect already exist?
# stat:
@ -94,7 +94,7 @@
dest: "{{ vector_map_path }}/index.html"
#when: not osm_redirect.stat.exists
- name: Reload Apache service ({{ apache_service }}) # e.g. apache2
- name: Reload nginx
systemd:
name: "{{ apache_service }}"
name: nginx
state: reloaded

View file

@ -3,13 +3,13 @@
src: /etc/apache2/sites-available/sugarizer.conf
path: /etc/apache2/sites-enabled/sugarizer.conf
state: link
when: sugarizer_enabled | bool and not nginx_enabled | bool
when: sugarizer_enabled and not nginx_enabled
- name: Remove symlink /etc/apache2/sites-enabled/sugarizer.conf (if not sugarizer_enabled)
file:
path: /etc/apache2/sites-enabled/sugarizer.conf
state: absent
when: not sugarizer_enabled | bool or nginx_enabled | bool
when: not sugarizer_enabled or nginx_enabled
- name: "Install sugarizer-nginx.conf (nginx)"
template:
@ -19,8 +19,14 @@
owner: root
group: root
with_items:
- { src: 'sugarizer-nginx.conf', dest: '/etc/nginx/conf.d/sugarizer-nginx.conf' , mode: '0644' }
when: sugarizer_enabled | bool and nginx_enabled | bool
- { src: 'sugarizer-nginx.conf', dest: '{{ nginx_config_dir }}/sugarizer-nginx.conf', mode: '0644' }
when: sugarizer_enabled and nginx_enabled
- name: Remove {{ nginx_config_dir }}/sugarizer-nginx.conf (if not sugarizer_enabled)
file:
path: "{{ nginx_config_dir }}/sugarizer-nginx.conf"
state: absent
when: not sugarizer_enabled and nginx_enabled
# 6. RESTART/STOP SYSTEMD SERVICE
@ -31,7 +37,7 @@
daemon_reload: yes
enabled: yes
state: restarted
when: sugarizer_enabled | bool
when: sugarizer_enabled
- name: Disable & Stop 'sugarizer' systemd service (if not sugarizer_enabled)
systemd:
@ -62,7 +68,7 @@
systemd:
name: "{{ apache_service }}" # httpd or apache2
state: restarted
when: sugarizer_enabled | bool and not nginx_enabled | bool
when: sugarizer_enabled and not nginx_enabled
- name: Restart nginx when enabled
systemd:

View file

@ -3,7 +3,7 @@
src: /etc/apache2/sites-available/wordpress.conf
path: /etc/apache2/sites-enabled/wordpress.conf
state: link
when: wordpress_enabled and is_debuntu
when: wordpress_enabled and not nginx_enabled
- name: Remove /etc/apache2/sites-enabled/wordpress.conf if not wordpress_enabled (debuntu)
file:
@ -11,10 +11,29 @@
state: absent
when: not wordpress_enabled and is_debuntu
- name: Install {{ nginx_config_dir }}/wordpress-nginx.conf from template, for http://box{{ wp_url }}
template:
src: wordpress-nginx.conf.j2
dest: "{{ nginx_config_dir }}/wordpress-nginx.conf"
when: wordpress_enabled and nginx_enabled
- name: Remove {{ nginx_config_dir }}/wordpress-nginx.conf if not wordpress_enabled (debuntu)
file:
path: "{{ nginx_config_dir }}/wordpress-nginx.conf"
state: absent
when: not wordpress_enabled and nginx_enabled
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box{{ wp_url }}
systemd:
name: "{{ apache_service }}"
state: restarted
when: not nginx_enabled
- name: Restart nginx service to enable/disable http://box{{ wp_url }}
systemd:
name: nginx
state: restarted
when: nginx_enabled
- name: Add 'wordpress' variable values to {{ iiab_ini_file }}
ini_file:

View file

@ -101,12 +101,6 @@
dest: "/etc/{{ apache_config_dir }}/wordpress.conf"
when: apache_enabled
- name: Install {{ nginx_config_dir }}/wordpress-nginx.conf from template, for http://box{{ wp_url }}
template:
src: wordpress-nginx.conf.j2
dest: "{{ nginx_config_dir }}/wordpress-nginx.conf"
when: nginx_enabled
- name: Add 'wordpress_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_state_file }}"