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

Reduce dependency on Apache in 9 playbooks

This commit is contained in:
root 2020-05-16 22:48:52 -04:00
parent 83b44f0a89
commit 13bc1e960f
9 changed files with 42 additions and 35 deletions

View file

@ -1,7 +1,7 @@
# TO DO: # TO DO:
# #
# - Prepare for a possible future w/o Apache by verifying/refining below... # - Prepare for a possible future w/o Apache by verifying/refining below...
# - 5 'when: apache_install | bool' # - 5 'when: apache_installed is defined'
# - 1 'when: nginx_install | bool' # - 1 'when: nginx_install | bool'
# - 8 core stanzas w/o such 'when:' clauses # - 8 core stanzas w/o such 'when:' clauses
@ -19,11 +19,11 @@
- libapache2-mod-authnz-external - libapache2-mod-authnz-external
- apache2-utils - apache2-utils
state: present state: present
when: apache_install | bool when: apache_installed is defined
- name: Run 'a2enmod cgi' to enable cgi execution via Apache - name: Run 'a2enmod cgi' to enable cgi execution via Apache
command: a2enmod cgi command: a2enmod cgi
when: apache_install | bool when: apache_installed is defined
- name: Create directory... mkdir {{ apache_log_dir }}, recursively chown {{ apache_user }}:{{ apache_user }}, with chmod u+rw,g+r,g-w,o-rwx - name: Create directory... mkdir {{ apache_log_dir }}, recursively chown {{ apache_user }}:{{ apache_user }}, with chmod u+rw,g+r,g-w,o-rwx
file: file:
@ -34,7 +34,7 @@
group: "{{ apache_user }}" group: "{{ apache_user }}"
mode: u+rw,g+r,g-w,o-rwx # '0750' turned on too many x bits mode: u+rw,g+r,g-w,o-rwx # '0750' turned on too many x bits
#force: yes #force: yes
when: apache_install | bool when: apache_installed is defined
- name: Create 2 directories... mkdir {{ awstats_data_dir }} (intermediate summary storage) and /usr/lib/cgi-bin/awstats, recursively chown {{ apache_user }}:{{ apache_user }}, with chmod u+rw,g+r,g-w,o-rwx - name: Create 2 directories... mkdir {{ awstats_data_dir }} (intermediate summary storage) and /usr/lib/cgi-bin/awstats, recursively chown {{ apache_user }}:{{ apache_user }}, with chmod u+rw,g+r,g-w,o-rwx
file: file:
@ -53,13 +53,13 @@
template: template:
src: apache-awstats.conf src: apache-awstats.conf
dest: "/etc/{{ apache_conf_dir }}/awstats.conf" # apache2/sites-available on debuntu dest: "/etc/{{ apache_conf_dir }}/awstats.conf" # apache2/sites-available on debuntu
when: apache_install | bool when: apache_installed is defined
- name: Install /etc/logrotate.d/apache2 from template, to ensure logrotate doesn't make logs unreadable - name: Install /etc/logrotate.d/apache2 from template, to ensure logrotate doesn't make logs unreadable
template: template:
src: logrotate.d.apache2 src: logrotate.d.apache2
dest: /etc/logrotate.d/apache2 dest: /etc/logrotate.d/apache2
when: apache_install | bool when: apache_installed is defined
- name: Does /etc/awstats/awstats.conf exist? - name: Does /etc/awstats/awstats.conf exist?
stat: stat:

View file

@ -22,8 +22,8 @@
mode: '0755' mode: '0755'
with_items: with_items:
- "{{ calibreweb_home }}" # /library/calibre-web - "{{ calibreweb_home }}" # /library/calibre-web
- "{{ calibreweb_venv_path }}" # /usr/local/calibre-web
- "{{ calibreweb_config }}" # /library/calibre-web/config - "{{ calibreweb_config }}" # /library/calibre-web/config
- "{{ calibreweb_venv_path }}" # /usr/local/calibre-web-py3
## TODO: Calibre-web future release might get into pypi https://github.com/janeczku/calibre-web/issues/456 ## TODO: Calibre-web future release might get into pypi https://github.com/janeczku/calibre-web/issues/456
- name: Clone i.e. download Calibre-Web ({{ calibreweb_version }}) from https://github.com/janeczku/calibre-web.git to {{ calibreweb_venv_path }} - name: Clone i.e. download Calibre-Web ({{ calibreweb_version }}) from https://github.com/janeczku/calibre-web.git to {{ calibreweb_venv_path }}
@ -61,7 +61,7 @@
template: template:
src: calibre-web.conf.j2 src: calibre-web.conf.j2
dest: "/etc/{{ apache_conf_dir }}/calibre-web.conf" # apache2/sites-available on debuntu dest: "/etc/{{ apache_conf_dir }}/calibre-web.conf" # apache2/sites-available on debuntu
when: apache_install | bool when: apache_installed is defined
- name: Does /library/calibre-web/metadata.db exist? - name: Does /library/calibre-web/metadata.db exist?
stat: stat:

View file

@ -43,18 +43,20 @@
extra_args: "--no-cache-dir" extra_args: "--no-cache-dir"
when: internet_available | bool when: internet_available | bool
- name: "Install from template: venv wrapper /usr/bin/kalite, systemd unit file kalite-serve.service, Apache's kalite.conf" - name: "Install from templates: venv wrapper /usr/bin/kalite, systemd unit file kalite-serve.service"
template: template:
backup: no
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: root
group: root
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
with_items: with_items:
- { src: 'kalite.sh.j2', dest: '/usr/bin/kalite', mode: '0755' } - { src: 'kalite.sh.j2', dest: '/usr/bin/kalite', mode: '0755' }
- { src: 'kalite-serve.service.j2', dest: '/etc/systemd/system/kalite-serve.service', mode: '0644' } - { src: 'kalite-serve.service.j2', dest: '/etc/systemd/system/kalite-serve.service', mode: '0644' }
- { src: 'kalite.conf', dest: '/etc/{{ apache_conf_dir }}', mode: '0644'}
- name: "Install from template: /etc/{{ apache_conf_dir }}/kalite.conf"
template:
src: kalite.conf
dest: "/etc/{{ apache_conf_dir }}" # apache2/sites-available on debuntu
when: apache_installed is defined
- name: Fix KA Lite bug in regex parsing ifconfig output, for @m-anish's network names that contain dashes, if Raspbian/Debian < 11 or Ubuntu < 20 - name: Fix KA Lite bug in regex parsing ifconfig output, for @m-anish's network names that contain dashes, if Raspbian/Debian < 11 or Ubuntu < 20
replace: replace:

View file

@ -100,7 +100,7 @@
# 4. INSTALL iiab-make-kiwix-lib*, kiwix-serve.service, kiwix.conf for Apache # 4. INSTALL iiab-make-kiwix-lib*, kiwix-serve.service, kiwix.conf for Apache
- name: 'Install from templates: kiwix-serve.service, iiab-make-kiwix-lib, iiab-make-kiwix-lib.py, kiwix.conf' - name: 'Install from templates: kiwix-serve.service, iiab-make-kiwix-lib, iiab-make-kiwix-lib.py'
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
@ -109,7 +109,13 @@
- { src: 'kiwix-serve.service.j2', dest: '/etc/systemd/system/kiwix-serve.service', mode: '0644' } - { src: 'kiwix-serve.service.j2', dest: '/etc/systemd/system/kiwix-serve.service', mode: '0644' }
- { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755' } - { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755' }
- { src: 'iiab-make-kiwix-lib3.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755' } - { src: 'iiab-make-kiwix-lib3.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755' }
- { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_conf_dir }}/kiwix.conf', mode: '0644' }
- name: "Install from template: Apache's kiwix.conf"
template:
src: kiwix.conf.j2
dest: "/etc/{{ apache_conf_dir }}/kiwix.conf"
#mode: '0644'
when: apache_installed is defined
# 5. RECORD Kiwix AS INSTALLED # 5. RECORD Kiwix AS INSTALLED

View file

@ -109,7 +109,7 @@
template: template:
src: nextcloud.conf.j2 src: nextcloud.conf.j2
dest: "/etc/{{ apache_conf_dir }}/nextcloud.conf" # apache2/sites-available on debuntu dest: "/etc/{{ apache_conf_dir }}/nextcloud.conf" # apache2/sites-available on debuntu
when: apache_install | bool when: apache_installed is defined
# RECORD Nextcloud AS INSTALLED # RECORD Nextcloud AS INSTALLED

View file

@ -148,18 +148,16 @@
# 5. CONFIG FILES # 5. CONFIG FILES
- name: "Install from templates: /etc/systemd/system/sugarizer.service, /etc/apache2/sites-available/sugarizer.conf" - name: "Install from template: /etc/systemd/system/sugarizer.service"
template: template:
src: "{{ item.src }}" src: sugarizer.service
dest: "{{ item.dest }}" dest: /etc/systemd/system
# owner: root
# group: root - name: "Install from template: /etc/{{ apache_conf_dir }}/sugarizer.conf"
# mode: '0644' template:
with_items: src: sugarizer.conf.j2
- { src: 'sugarizer.service', dest: '/etc/systemd/system/sugarizer.service' } dest: "/etc/{{ apache_conf_dir }}/sugarizer.conf" # apache2/sites-available
- { src: 'sugarizer.conf.j2', dest: "/etc/{{ apache_conf_dir }}/sugarizer.conf" } when: apache_installed is defined
#- { src: 'sugarizer.ini.j2', dest: '{{ iiab_base }}/sugarizer-server/env/sugarizer.ini' }
#- { src: 'sugarizer.js', dest: '{{ iiab_base }}/sugarizer-server' }
# 3 [WAS 4] STANZAS ADDED BELOW JAN/FEB 2019, HOPING THIS MIGHT "JUST WORK" # 3 [WAS 4] STANZAS ADDED BELOW JAN/FEB 2019, HOPING THIS MIGHT "JUST WORK"
# WITH FUTURE UPGRADES BEYOND SUGARIZER 1.1?! # WITH FUTURE UPGRADES BEYOND SUGARIZER 1.1?!

View file

@ -28,7 +28,7 @@
template: template:
src: content_dir.conf src: content_dir.conf
dest: "/etc/{{ apache_conf_dir }}" # apache2/sites-available on debuntu dest: "/etc/{{ apache_conf_dir }}" # apache2/sites-available on debuntu
when: apache_install when: apache_installed is defined
# RECORD 'USB_LIB' AS INSTALLED # RECORD 'USB_LIB' AS INSTALLED

View file

@ -89,7 +89,7 @@
template: template:
src: wordpress.conf.j2 src: wordpress.conf.j2
dest: "/etc/{{ apache_conf_dir }}/wordpress.conf" dest: "/etc/{{ apache_conf_dir }}/wordpress.conf"
when: apache_enabled | bool when: apache_installed is defined
# RECORD WordPress AS INSTALLED # RECORD WordPress AS INSTALLED

View file

@ -15,12 +15,13 @@
# Used to be run by httpd/tasks/install.yml # Used to be run by httpd/tasks/install.yml
- name: "IN CASE NGINX IS DISABLED: Enable IIAB pages via Apache (e.g. on port 80) if apache_install" - name: "IN CASE NGINX IS DISABLED: Enable IIAB pages via Apache (e.g. on port 80) if apache_install"
include_tasks: roles/httpd/tasks/homepage.yml include_tasks: roles/httpd/tasks/homepage.yml
when: apache_install | bool when: apache_installed is defined
# Used to be run by nginx/tasks/install.yml # Used to be run by nginx/tasks/install.yml
- name: Enable IIAB pages via NGINX (e.g. on port 80) if nginx_install - name: Enable IIAB pages via NGINX (e.g. on port 80) if nginx_install
include_tasks: roles/nginx/tasks/homepage.yml include_tasks: roles/nginx/tasks/homepage.yml
when: nginx_install | bool when: nginx_installed is defined
#when: nginx_install | bool
- debug: - debug:
msg: 'THE 3 ANSIBLE STANZAS BELOW ONLY RUN... when: (nginx_high_php_limits or moodle_install or nextcloud_install or pbx_install or wordpress_install) and nginx_enabled' msg: 'THE 3 ANSIBLE STANZAS BELOW ONLY RUN... when: (nginx_high_php_limits or moodle_install or nextcloud_install or pbx_install or wordpress_install) and nginx_enabled'
@ -100,11 +101,11 @@
when: internet_available and not nodocs when: internet_available and not nodocs
- name: (Re)Start '{{ apache_service }}' systemd service, if apache_enabled - name: (Re)Start '{{ apache_service }}' systemd service, if installed & enabled
systemd: systemd:
name: "{{ apache_service }}" # apache2 on debuntu name: "{{ apache_service }}" # apache2 on debuntu
state: restarted state: restarted
when: apache_enabled | bool when: apache_installed is defined and apache_enabled
- name: (Re)Start 'nginx' systemd service, if nginx_enabled - name: (Re)Start 'nginx' systemd service, if nginx_enabled
systemd: systemd: