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

Merge pull request #357 from iiab/master

sync from iiab:master
This commit is contained in:
A Holt 2020-01-24 01:05:07 -05:00 committed by GitHub
commit a435388996
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 407 additions and 326 deletions

View file

@ -33,10 +33,28 @@
setup: setup:
filter: ansible_local filter: ansible_local
# 2020-01-21: checks 46+46 vars...for now...expect validate_vars.yml to change! - name: Pre-check that IIAB's "XYZ_install" + "XYZ_enabled" vars (1) are defined, (2) are boolean-not-string variables, and (3) contain plausible values. Also checks that "XYZ_install" is True when "XYZ_installed" is defined.
- name: Pre-check that IIAB's "XYZ_install" + "XYZ_enabled" vars (1) are defined, (2) are boolean-not-string variables, and (3) contain plausible values
include_tasks: validate_vars.yml include_tasks: validate_vars.yml
# SEE: https://github.com/iiab/iiab/blob/master/roles/nginx/README.md
- name: "apache_install is currently '{{ apache_install }}' and apache_enabled is currently '{{ apache_enabled }}'. Now let's set 'apache_install: True' and 'apache_enabled: True' if NGINX is set not to be enabled OR if any of {DokuWiki, Elgg, Lokole, Moodle, Nextcloud, Node-RED} are set to install."
set_fact:
apache_install: True
apache_enabled: True
when: not nginx_enabled or dokuwiki_install or elgg_install or lokole_install or moodle_install or nextcloud_install or nodered_install
#
#- name: "Verify 'apache_install: True' and 'apache_enabled: True' if any of {DokuWiki, Elgg, Lokole, Moodle, Nextcloud, Node-RED} are set to install"
# assert:
# that: apache_install and apache_enabled or not (dokuwiki_install or elgg_install or lokole_install or moodle_install or nextcloud_install or nodered_install)
# fail_msg: "PLEASE CONFIRM 'apache_install: True' AND 'apache_enable: True' IF YOU'RE TRYING TO INSTALL ANY OF {dokuwiki, elgg, lokole, moodle, nextcloud, nodered} e.g. IN: /etc/iiab/local_vars.yml"
# quiet: yes
#
#- name: "Verify 'apache_install: True' and 'apache_enabled: True' if 'nginx_enabled: False' -- e.g. for Apache testing of older playbooks lacking full NGINX support"
# assert:
# that: apache_install and apache_enabled or nginx_enabled
# fail_msg: "PLEASE CONFIRM 'apache_install: True' AND 'apache_enable: True' IF 'nginx_enabled: False' e.g. IN: /etc/iiab/local_vars.yml"
# quiet: yes
- name: Set top-level variables from local_facts for convenience - name: Set top-level variables from local_facts for convenience
set_fact: set_fact:
xo_model: "{{ ansible_local.local_facts.xo_model }}" xo_model: "{{ ansible_local.local_facts.xo_model }}"
@ -47,8 +65,8 @@
set_fact: set_fact:
rpi_model: "rpi" rpi_model: "rpi"
is_rpi: True is_rpi: True
# no_net_restart: True #no_net_restart: True
# nobridge: True #nobridge: True
when: ansible_local.local_facts.os == "raspbian" when: ansible_local.local_facts.os == "raspbian"
- name: Set exFAT_enabled if xo_model != "none" - name: Set exFAT_enabled if xo_model != "none"
@ -78,11 +96,11 @@
get_url: get_url:
url: "{{ iiab_download_url }}/heart-beat.txt" url: "{{ iiab_download_url }}/heart-beat.txt"
dest: /tmp/heart-beat.txt dest: /tmp/heart-beat.txt
# timeout: "{{ download_timeout }}" #timeout: "{{ download_timeout }}"
# @jvonau recommends: 100sec is too much (keep 10sec default) # @jvonau recommends: 100sec is too much (keep 10sec default)
ignore_errors: True ignore_errors: True
# async: 10 #async: 10
# poll: 2 #poll: 2
register: internet_access_test register: internet_access_test
- name: Set internet_available if download succeeded and not disregard_network - name: Set internet_available if download succeeded and not disregard_network
@ -109,12 +127,6 @@
gui_port: 443 gui_port: 443
when: adm_cons_force_ssl | bool when: adm_cons_force_ssl | bool
# SEE: https://github.com/iiab/iiab/blob/master/roles/nginx/README.md
- name: "Set 'apache_enabled: True' if any of {DokuWiki, Elgg, Lokole, Moodle, Nextcloud, Node-RED} are set to install"
set_fact:
apache_enabled: True
when: dokuwiki_install or elgg_install or lokole_install or moodle_install or nextcloud_install or nodered_install
- name: Turn on both vars for MySQL (mandatory in Stage 3!) - name: Turn on both vars for MySQL (mandatory in Stage 3!)
set_fact: set_fact:
mysql_install: True mysql_install: True
@ -123,19 +135,6 @@
# We decided to enable mysql unconditionally. # We decided to enable mysql unconditionally.
# when: elgg_enabled or rachel_enabled or owncloud_enabled or phpmyadmin_enabled or wordpress_enabled or iiab_menu_install # when: elgg_enabled or rachel_enabled or owncloud_enabled or phpmyadmin_enabled or wordpress_enabled or iiab_menu_install
# There might be other db's
- name: Turn on both vars for PostgreSQL if moodle_enabled or pathagar_enabled
set_fact:
postgresql_install: True
postgresql_enabled: True
when: moodle_enabled or (pathagar_enabled is defined and pathagar_enabled)
#- name: Turn on vars for Docker if SchoolTool is to be installed
# set_fact:
# docker_install: True
# docker_enabled: True
# when: schooltool_enabled or schooltool_install
- name: "Set python_path: /lib/python2.7/site-packages/ (redhat)" - name: "Set python_path: /lib/python2.7/site-packages/ (redhat)"
set_fact: set_fact:
python_path: /lib/python2.7/site-packages/ python_path: /lib/python2.7/site-packages/

View file

@ -66,26 +66,22 @@
include_role: include_role:
name: sshd name: sshd
# has no "when: XXXXX_install" flag # has no "when: XXXXX_install" flag
#tags: base, sshd
- name: IIAB-ADMIN - name: IIAB-ADMIN
include_role: include_role:
name: iiab-admin name: iiab-admin
# has no "when: XXXXX_install" flag # has no "when: XXXXX_install" flag
#tags: base, iiab-admin
- name: OPENVPN - name: OPENVPN
include_role: include_role:
name: openvpn name: openvpn
when: openvpn_install | bool when: openvpn_install | bool
#tags: openvpn
# for rpi, without rtc, we need time as soon as possible # for rpi, without rtc, we need time as soon as possible
- name: Install chrony (an NTP package) especially for RPi's lacking RTC - name: Install chrony (an NTP package) especially for RPi's lacking RTC
package: package:
name: chrony name: chrony
state: present state: present
#tags: download
#TODO: Use regexp filter instead of hard-code ip #TODO: Use regexp filter instead of hard-code ip
- name: Install /etc/chrony.conf from template - name: Install /etc/chrony.conf from template

View file

@ -7,13 +7,11 @@
include_role: include_role:
name: httpd name: httpd
when: apache_install | bool when: apache_install | bool
#tags: base, httpd
- name: MYSQL - name: MYSQL
include_role: include_role:
name: mysql name: mysql
when: mysql_install | bool when: mysql_install | bool
#tags: base, mysql
- name: Install NGINX (configured LATER, in Stage 9-LOCAL-ADDONS) - name: Install NGINX (configured LATER, in Stage 9-LOCAL-ADDONS)
include_tasks: roles/nginx/tasks/install.yml include_tasks: roles/nginx/tasks/install.yml
@ -22,7 +20,6 @@
- name: Install dnsmasq - name: Install dnsmasq
include_tasks: roles/network/tasks/dnsmasq.yml include_tasks: roles/network/tasks/dnsmasq.yml
when: dnsmasq_install | bool when: dnsmasq_install | bool
#tags: base, domain, dnsmasq, network
- name: Recording STAGE 3 HAS COMPLETED ===================== - name: Recording STAGE 3 HAS COMPLETED =====================
lineinfile: lineinfile:

View file

@ -8,63 +8,41 @@
- name: Install named / BIND - name: Install named / BIND
include_tasks: roles/network/tasks/named.yml include_tasks: roles/network/tasks/named.yml
when: named_install | bool when: named_install | bool
#tags: base, named, network, domain
- name: Installing dhcpd - name: Installing dhcpd
include_tasks: roles/network/tasks/dhcpd.yml include_tasks: roles/network/tasks/dhcpd.yml
when: dhcpd_install | bool when: dhcpd_install | bool
#tags: base, dhcpd, network, domain
- name: Install Squid (and DansGuardian if dansguardian_install) - name: Install Squid (and DansGuardian if dansguardian_install)
include_tasks: roles/network/tasks/squid.yml include_tasks: roles/network/tasks/squid.yml
when: squid_install | bool when: squid_install | bool
#tags: base, squid, network, domain
- name: Install Bluetooth - only on Raspberry Pi - name: Install Bluetooth - only on Raspberry Pi
include_role: include_role:
name: bluetooth name: bluetooth
when: (is_rpi and bluetooth_install) or bluetooth_installed is defined when: is_rpi and bluetooth_install # or bluetooth_installed is defined
#tags: bluetooth
- name: USB-LIB - name: USB-LIB
include_role: include_role:
name: usb-lib name: usb-lib
when: usb_lib_install | bool when: usb_lib_install | bool
#tags: usb-lib
# NETWORK moved to the very end, after Stage 9 (9-LOCAL-ADDONS) # This is in Stage 4-SERVER-OPTIONS (rather than 3-BASE-SERVER) because var
# It can also be run manually using: cd /opt/iiab/iiab; ./iiab-network # iiab_home_url changes, and may need to be re-run in the field/offline/etc.
#
#- name: NETWORK
# include_role:
# name: network
# # has no "when: XXXXX_install" flag
# tags: base, network
# MANDATORY SO PERHAPS THIS BELONGS IN 3-BASE-SERVER ?
- name: HOMEPAGE - name: HOMEPAGE
include_role: include_role:
name: homepage name: homepage
# has no "when: XXXXX_install" flag # has no "when: XXXXX_install" flag
#tags: base, homepage
- name: POSTGRESQL
include_role:
name: postgresql
when: postgresql_install | bool
#tags: postgresql, pathagar, moodle
- name: CUPS - name: CUPS
include_role: include_role:
name: cups name: cups
when: cups_install or cups_installed is defined when: cups_install # or cups_installed is defined
#tags: cups
- name: SAMBA - name: SAMBA
include_role: include_role:
name: samba name: samba
when: samba_install or samba_installed is defined when: samba_install # or samba_installed is defined
#tags: samba
- name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (This script was installed at the beginning of Stage 3 = roles/3-base-server/tasks/main.yml, which ran Apache playbook = roles/httpd/tasks/main.yml) - name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (This script was installed at the beginning of Stage 3 = roles/3-base-server/tasks/main.yml, which ran Apache playbook = roles/httpd/tasks/main.yml)
command: /usr/bin/iiab-refresh-wiki-docs command: /usr/bin/iiab-refresh-wiki-docs

View file

@ -3,24 +3,23 @@
- name: ...IS BEGINNING ===================================== - name: ...IS BEGINNING =====================================
command: echo command: echo
# UNMAINTAINED
- name: ACTIVITY-SERVER - name: ACTIVITY-SERVER
include_role: include_role:
name: activity-server name: activity-server
when: activity_server_install | bool when: activity_server_install is defined and activity_server_install
#tags: olpc, activity-server
# UNMAINTAINED
- name: EJABBERD_XS - name: EJABBERD_XS
include_role: include_role:
name: ejabberd_xs name: ejabberd_xs
when: ejabberd_xs_install | bool when: ejabberd_xs_install is defined and ejabberd_xs_install
#tags: olpc, ejabberd-xs
# UNMAINTAINED # UNMAINTAINED
- name: IDMGR - name: IDMGR
include_role: include_role:
name: idmgr name: idmgr
when: idmgr_install | bool when: idmgr_install is defined and idmgr_install
#tags: olpc, idmgr
- name: Recording STAGE 5 HAS COMPLETED ===================== - name: Recording STAGE 5 HAS COMPLETED =====================
lineinfile: lineinfile:

View file

@ -7,75 +7,63 @@
include_role: include_role:
name: azuracast name: azuracast
when: azuracast_install | bool when: azuracast_install | bool
#tags: azuracast
# UNMAINTAINED # UNMAINTAINED
- name: DOKUWIKI - name: DOKUWIKI
include_role: include_role:
name: dokuwiki name: dokuwiki
when: dokuwiki_install | bool when: dokuwiki_install is defined and dokuwiki_install
#tags: dokuwiki
# UNMAINTAINED # UNMAINTAINED
- name: EJABBERD - name: EJABBERD
include_role: include_role:
name: ejabberd name: ejabberd
when: ejabberd_install | bool when: ejabberd_install is defined and ejabberd_install
#tags: ejabberd
- name: ELGG - name: ELGG
include_role: include_role:
name: elgg name: elgg
when: elgg_install | bool when: elgg_install | bool
#tags: elgg
- name: GITEA - name: GITEA
include_role: include_role:
name: gitea name: gitea
when: gitea_install | bool when: gitea_install | bool
#tags: gitea
- name: LOKOLE - name: LOKOLE
include_role: include_role:
name: lokole name: lokole
when: lokole_install | bool when: lokole_install | bool
#tags: lokole
- name: MEDIAWIKI - name: MEDIAWIKI
include_role: include_role:
name: mediawiki name: mediawiki
when: mediawiki_install | bool when: mediawiki_install | bool
#tags: mediawiki
- name: MOSQUITTO - name: MOSQUITTO
include_role: include_role:
name: mosquitto name: mosquitto
when: mosquitto_install | bool when: mosquitto_install | bool
#tags: mosquitto
- name: NODE-RED - name: NODE-RED
include_role: include_role:
name: nodered name: nodered
when: nodered_install | bool when: nodered_install | bool
#tags: nodered
- name: NEXTCLOUD - name: NEXTCLOUD
include_role: include_role:
name: nextcloud name: nextcloud
when: nextcloud_install | bool when: nextcloud_install | bool
#tags: nextcloud
- name: PBX - name: PBX
include_role: include_role:
name: pbx name: pbx
when: pbx_install | bool when: pbx_install | bool
#tags: pbx
- name: WORDPRESS - name: WORDPRESS
include_role: include_role:
name: wordpress name: wordpress
when: wordpress_install | bool when: wordpress_install | bool
#tags: wordpress
- name: Recording STAGE 6 HAS COMPLETED ==================== - name: Recording STAGE 6 HAS COMPLETED ====================
lineinfile: lineinfile:

View file

@ -7,51 +7,43 @@
include_role: include_role:
name: kalite name: kalite
when: kalite_install | bool when: kalite_install | bool
#tags: kalite
- name: KOLIBRI - name: KOLIBRI
include_role: include_role:
name: kolibri name: kolibri
when: kolibri_install | bool when: kolibri_install | bool
#tags: kolibri
- name: KIWIX - name: KIWIX
include_role: include_role:
name: kiwix name: kiwix
when: kiwix_install | bool when: kiwix_install | bool
#tags: kiwix
- name: MOODLE - name: MOODLE
include_role: include_role:
name: moodle name: moodle
when: moodle_install | bool when: moodle_install | bool
#tags: olpc, moodle
- name: OSM-VECTOR-MAPS - name: OSM-VECTOR-MAPS
include_role: include_role:
name: osm-vector-maps name: osm-vector-maps
when: osm_vector_maps_install | bool when: osm_vector_maps_install | bool
#tags: osm, maps
# UNMAINTAINED # UNMAINTAINED
- name: OSM - name: OSM
include_role: include_role:
name: osm name: osm
when: osm_install is defined and osm_install when: osm_install is defined and osm_install
#tags: osm, maps
# UNMAINTAINED # UNMAINTAINED
- name: PATHAGAR - name: PATHAGAR
include_role: include_role:
name: pathagar name: pathagar
when: pathagar_install is defined and pathagar_install when: pathagar_install is defined and pathagar_install
#tags: pathagar
- name: SUGARIZER - name: SUGARIZER
include_role: include_role:
name: sugarizer name: sugarizer
when: sugarizer_install | bool when: sugarizer_install | bool
#tags: sugarizer
- name: Recording STAGE 7 HAS COMPLETED ======================== - name: Recording STAGE 7 HAS COMPLETED ========================
lineinfile: lineinfile:

View file

@ -7,37 +7,31 @@
include_role: include_role:
name: transmission name: transmission
when: transmission_install | bool when: transmission_install | bool
#tags: transmission
- name: AWSTATS - name: AWSTATS
include_role: include_role:
name: awstats name: awstats
when: awstats_install | bool when: awstats_install | bool
#tags: awstats
- name: MONIT - name: MONIT
include_role: include_role:
name: monit name: monit
when: monit_install | bool when: monit_install | bool
#tags: monit
- name: MUNIN - name: MUNIN
include_role: include_role:
name: munin name: munin
when: munin_install | bool when: munin_install | bool
#tags: munin
- name: PHPMYADMIN - name: PHPMYADMIN
include_role: include_role:
name: phpmyadmin name: phpmyadmin
when: phpmyadmin_install | bool when: phpmyadmin_install | bool
#tags: phpmyadmin
- name: VNSTAT - name: VNSTAT
include_role: include_role:
name: vnstat name: vnstat
when: vnstat_install | bool when: vnstat_install | bool
#tags: vnstat
- name: Recording STAGE 8 HAS COMPLETED ====================== - name: Recording STAGE 8 HAS COMPLETED ======================
lineinfile: lineinfile:

View file

@ -7,7 +7,6 @@
include_role: include_role:
name: internetarchive name: internetarchive
when: internetarchive_install | bool when: internetarchive_install | bool
#tags: internetarchive
# Is porting to Python 3 complete, and if so does this belong elsewhere? # Is porting to Python 3 complete, and if so does this belong elsewhere?
- name: CAPTIVE PORTAL - name: CAPTIVE PORTAL
@ -15,43 +14,41 @@
name: captiveportal name: captiveportal
#include_tasks: roles/captiveportal/tasks/main.yml #include_tasks: roles/captiveportal/tasks/main.yml
when: captiveportal_install | bool when: captiveportal_install | bool
#tags: base, captiveportal, network, domain
- name: MINETEST - name: MINETEST
include_role: include_role:
name: minetest name: minetest
when: minetest_install | bool when: minetest_install | bool
#tags: minetest
# KEEP AT THE END as this installs dependencies from Debian's 'testing' branch! # KEEP AT THE END as this installs dependencies from Debian's 'testing' branch!
- name: CALIBRE - name: CALIBRE
include_role: include_role:
name: calibre name: calibre
when: calibre_install | bool when: calibre_install | bool
#tags: calibre
- name: CALIBRE-WEB - name: CALIBRE-WEB
include_role: include_role:
name: calibre-web name: calibre-web
when: calibreweb_install | bool when: calibreweb_install | bool
#tags: calibre-web
# Could split these two below to Stage 10? # Could split these two below to Stage 10?
- name: Configure NGINX (already installed in Stage 3-BASE-SERVER) - name: Fully Enable / Configure NGINX (already installed in Stage 3-BASE-SERVER) if 'nginx_enabled' is True
# If just CONFIGURING, should we use one of the following instead ??
# include_tasks: roles/nginx/tasks/setup.yml
# include_tasks: roles/nginx/tasks/enable.yml
include_role: include_role:
name: nginx name: nginx
when: nginx_install | bool when: nginx_enabled | bool # WAS: nginx_install
#tags: base, nginx # If just CONFIGURING (etc) shouldn't we use one of the following instead ??
# include_tasks: roles/nginx/tasks/setup.yml
# include_tasks: roles/nginx/tasks/enable.yml
- name: Configure Apache systemd service ({{ apache_service }}) - name: Fully Enable / Configure Apache systemd service ({{ apache_service }}) if 'apache_enabled' is True
include_role: include_role:
name: httpd-enable name: httpd-enable
when: apache_install | bool when: apache_enabled | bool # WAS: apache_install
#tags: base, httpd # WARNING THAT APACHE IS AUTO-ENABLED BY THESE ~6 APPS ALONE!
# https://github.com/holta/iiab/blob/scaff2/roles/0-init/tasks/main.yml#L40-L44
# Summarized @ https://github.com/iiab/iiab/blob/master/roles/nginx/README.md
# 2020-01-23: APACHE FUTURE SUMMARY QUESTIONS @ roles/httpd/tasks/main.yml
- name: Recording STAGE 9 HAS COMPLETED ==================== - name: Recording STAGE 9 HAS COMPLETED ====================
lineinfile: lineinfile:

View file

@ -2,7 +2,7 @@
# I want to perform input validation for Ansible playbooks" # I want to perform input validation for Ansible playbooks"
# https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499 # https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499
# If 0-init/tasks/validate_vars.yml has DEFINITELY been run (?) perhaps no need # We assume 0-init/tasks/validate_vars.yml has DEFINITELY been run, so no need
# to re-check whether vars are defined here. As Ansible vars cannot be unset: # to re-check whether vars are defined here. As Ansible vars cannot be unset:
# https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible # https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible
@ -11,24 +11,23 @@
that: captiveportal_install is sameas true that: captiveportal_install is sameas true
fail_msg: "PLEASE SET 'captiveportal_install: True' e.g. IN: /etc/iiab/local_vars.yml" fail_msg: "PLEASE SET 'captiveportal_install: True' e.g. IN: /etc/iiab/local_vars.yml"
quiet: yes quiet: yes
#that: captiveportal_install is defined and captiveportal_install is sameas true
#success_msg: captiveportal_install is defined and captiveportal_install is sameas true
- name: Assert that "captiveportal_enabled | type_debug == 'bool'" (boolean not string etc) - name: Assert that "captiveportal_enabled | type_debug == 'bool'" (boolean not string etc)
assert: assert:
that: captiveportal_enabled | type_debug == 'bool' that: captiveportal_enabled | type_debug == 'bool'
fail_msg: "PLEASE GIVE VARIABLE 'captiveportal_enabled' A PROPER (UNQUOTED) BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" fail_msg: "PLEASE GIVE VARIABLE 'captiveportal_enabled' A PROPER (UNQUOTED) BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml"
quiet: yes quiet: yes
#that: captiveportal_enabled is defined and captiveportal_enabled | type_debug == 'bool'
#success_msg: captiveportal_enabled is defined and captiveportal_enabled | type_debug == 'bool'
- name: Install Captive Portal if 'captiveportal_installed' is not defined in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - name: Install Captive Portal if 'captiveportal_installed' is not defined in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: install.yml include_tasks: install.yml
when: captiveportal_installed is undefined when: captiveportal_installed is undefined
- name: Enable or Disable Captive Portal - name: Enable or Disable Captive Portal
include_tasks: enable-or-disable.yml include_tasks: enable-or-disable.yml
- name: Add 'captiveportal' variable values to {{ iiab_ini_file }} - name: Add 'captiveportal' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"

View file

@ -39,8 +39,10 @@ doc_root = get_iiab_env("WWWROOT")
fully_qualified_domain_name = get_iiab_env("FQDN") fully_qualified_domain_name = get_iiab_env("FQDN")
loggingLevel = "ERROR" # 2020-01-23: @georgejhunt explained that "ERROR" does not log enough details.
#loggingLevel = "DEBUG" # So we're changing IIAB's default to "DEBUG", til Captive Portal proves solid.
#loggingLevel = "ERROR"
loggingLevel = "DEBUG"
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] == '-l': if sys.argv[1] == '-l':
loggingLevel = "DEBUG" loggingLevel = "DEBUG"

View file

@ -1,12 +1,22 @@
# 2020-01-23 TO DO / Questions:
# - Validate input vars apache_install & apache_enabled here.
# - Use as nec, with 'when: apache_installed is undefined'
# - Encapsulate all 3 tasks below into httpd/roles/install.yml ?
# - Similarly sanity-check httpd/roles/enable.yml...
# - Verify that 9-local-addons/tasks/main.yml's invocation of
# roles/httpd/tasks/enable.yml (via roles/httpd-enable/tasks/main.yml, if
# apache_enabled is True) does the right thing!
# - And that we really don't want to invoke it hereunder?
# - Save relevant apache_* vars to /etc/iiab/iiab.ini
- include_tasks: install.yml - include_tasks: install.yml
#tags: base
- include_tasks: html.yml - include_tasks: html.yml
#tags: base
# Partially fixes search @ http://box/modules/es-wikihow (on RPi anyway) see https://github.com/iiab/iiab/issues/829 # 2018-07-18: Partially fixes search @ http://box/modules/es-wikihow (on RPi
- include_tasks: php-stem.yml # anyway) https://github.com/iiab/iiab/issues/829 & PR #925
#tags: base # 2020-01-23: Deprecated as @tim-moody's attempt to revive this for PHP 7.3
# instead of 7.0 failed: https://github.com/iiab/iiab/issues/2123
#- include_tasks: php-stem.yml
- name: Install /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (Script can be run manually and/or at the end of Stage 4 = roles/4-server-options/tasks/main.yml) - name: Install /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (Script can be run manually and/or at the end of Stage 4 = roles/4-server-options/tasks/main.yml)
template: template:

View file

@ -1,3 +1,18 @@
- name: Enable 'postgresql-iiab' systemd service, if moodle_enabled
systemd:
name: postgresql-iiab
state: started
enabled: yes
when: moodle_enabled
# if the only service using the backend db disable if not running
- name: Disable 'postgresql-iiab' systemd service, if not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
systemd:
name: postgresql-iiab
state: stopped
enabled: no
when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
# Apache # Apache
- name: Enable http://box/moodle via Apache - name: Enable http://box/moodle via Apache
@ -8,7 +23,7 @@
command: a2dissite 022-moodle.conf command: a2dissite 022-moodle.conf
when: apache_install and not moodle_enabled when: apache_install and not moodle_enabled
- name: Restart Apache systemd service ({{ apache_service }}) - name: Restart '{{ apache_service }}' systemd service
systemd: systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted state: restarted

View file

@ -1,3 +1,12 @@
- name: "Set PostgreSQL vars 'postgresql_install: True' and 'postgresql_enabled: True'"
set_fact:
postgresql_install: True
postgresql_enabled: True
- name: POSTGRESQL - run the 'postgresql' role
include_role:
name: postgresql
- name: "Install packages: python-psycopg2, php-pgsql (OS's other than debuntu)" - name: "Install packages: python-psycopg2, php-pgsql (OS's other than debuntu)"
package: package:
name: name:

View file

@ -0,0 +1,12 @@
- name: Enable http://box/munin via Apache
command: a2ensite munin24.conf
when: munin_enabled
- name: Disable http://box/munin via Apache
command: a2dissite munin24.conf
when: not munin_enabled
- name: Restart '{{ apache_service }}' systemd service
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted

View file

@ -1,50 +0,0 @@
- name: Enable & Start 'munin-node' systemd service
systemd:
name: munin-node
daemon_reload: yes
enabled: yes
state: started
when: munin_enabled | bool
- name: Disable 'munin-node' systemd service
systemd:
name: munin-node
enabled: no
state: stopped
when: not munin_enabled
# Apache
- name: Enable http://box/munin via Apache
command: a2ensite munin24.conf
when: apache_install and munin_enabled # and not nginx_enabled
- name: Disable http://box/munin via Apache
command: a2dissite munin24.conf
when: apache_install and not munin_enabled # or nginx_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted
when: apache_install and apache_enabled
# NGINX
- name: Enable http://box/munin via NGINX, by installing {{ nginx_config_dir }}/munin24-nginx.conf from template
template:
src: munin24-nginx.conf.j2
dest: "{{ nginx_config_dir }}/munin24-nginx.conf" # /etc/nginx/conf.d
when: munin_enabled # and nginx_enabled
- name: Disable http://box/munin via NGINX, by installing {{ nginx_config_dir }}/munin24-nginx.conf
file:
path: "{{ nginx_config_dir }}/munin24-nginx.conf" # /etc/nginx/conf.d
state: absent
when: not munin_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted
# when: nginx_enabled | bool

View file

@ -2,7 +2,7 @@
# I want to perform input validation for Ansible playbooks" # I want to perform input validation for Ansible playbooks"
# https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499 # https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499
# If 0-init/tasks/validate_vars.yml has DEFINITELY been run (?) perhaps no need # We assume 0-init/tasks/validate_vars.yml has DEFINITELY been run, so no need
# to re-check whether vars are defined here. As Ansible vars cannot be unset: # to re-check whether vars are defined here. As Ansible vars cannot be unset:
# https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible # https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible
@ -11,23 +11,42 @@
that: munin_install is sameas true that: munin_install is sameas true
fail_msg: "PLEASE SET 'munin_install: True' e.g. IN: /etc/iiab/local_vars.yml" fail_msg: "PLEASE SET 'munin_install: True' e.g. IN: /etc/iiab/local_vars.yml"
quiet: yes quiet: yes
#that: munin_install is defined and munin_install is sameas true
#success_msg: munin_install is defined and munin_install is sameas true
- name: Assert that "munin_enabled | type_debug == 'bool'" (boolean not string etc) - name: Assert that "munin_enabled | type_debug == 'bool'" (boolean not string etc)
assert: assert:
that: munin_enabled | type_debug == 'bool' that: munin_enabled | type_debug == 'bool'
fail_msg: "PLEASE GIVE VARIABLE 'munin_enabled' A PROPER (UNQUOTED) BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" fail_msg: "PLEASE GIVE VARIABLE 'munin_enabled' A PROPER (UNQUOTED) BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml"
quiet: yes quiet: yes
#that: munin_enabled is defined and munin_enabled | type_debug == 'bool'
#success_msg: munin_enabled is defined and munin_enabled | type_debug == 'bool'
- name: Install Munin if 'munin_installed' is not defined in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - name: Install Munin if 'munin_installed' is not defined in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: install.yml include_tasks: install.yml
when: munin_installed is undefined when: munin_installed is undefined
- name: Enable or Disable Munin
include_tasks: enable-or-disable.yml - name: Enable & Start 'munin-node' systemd service
systemd:
name: munin-node
daemon_reload: yes
enabled: yes
state: started
when: munin_enabled | bool
- name: Disable & Stop 'munin-node' systemd service
systemd:
name: munin-node
enabled: no
state: stopped
when: not munin_enabled
- 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: Add 'munin' variable values to {{ iiab_ini_file }} - name: Add 'munin' variable values to {{ iiab_ini_file }}
ini_file: ini_file:

View file

@ -0,0 +1,16 @@
- name: Enable http://box/munin via NGINX, by installing {{ nginx_config_dir }}/munin24-nginx.conf from template
template:
src: munin24-nginx.conf.j2
dest: "{{ nginx_config_dir }}/munin24-nginx.conf" # /etc/nginx/conf.d
when: munin_enabled
- name: Disable http://box/munin via NGINX, by installing {{ nginx_config_dir }}/munin24-nginx.conf
file:
path: "{{ nginx_config_dir }}/munin24-nginx.conf" # /etc/nginx/conf.d
state: absent
when: not munin_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted

View file

@ -1,3 +1,10 @@
# TO DO:
# - Validate input vars mysql_install & mysql_enabled
# - Put ~12 stanzas just below into install.yml
# - Triggered by... 'when: mysql_installed is undefined'
# - Eliminate stale Fedora/CentOS code & gratuitous when: is_debuntu clauses?
# - Consider putting ~8 stanzas below that into enable.yml or similar?
- name: 'Install MySQL packages: mariadb-server, mariadb-client, and 8 php packages (debuntu)' - name: 'Install MySQL packages: mariadb-server, mariadb-client, and 8 php packages (debuntu)'
package: package:
name: name:
@ -14,19 +21,19 @@
- php{{ php_version }}-xmlrpc - php{{ php_version }}-xmlrpc
state: present state: present
when: is_debuntu | bool when: is_debuntu | bool
#tags: download
- name: Install php{{ php_version }}-xml (ubuntu or debian 9+) - name: Install package 'php{{ php_version }}-xml' (debuntu) # WAS: (ubuntu or debian 9+)
package: package:
name: "php{{ php_version }}-xml" name: "php{{ php_version }}-xml"
state: present state: present
when: is_ubuntu or (is_debian and not is_debian_8) when: is_debuntu | bool
#when: is_ubuntu or (is_debian and not is_debian_8)
- name: Install php-xml-parser (debian-8) #- name: Install php-xml-parser (debian-8)
package: # package:
name: php-xml-parser # name: php-xml-parser
state: present # state: present
when: is_debian_8 | bool # when: is_debian_8 | bool
- name: "Install packages: mysql, MySQL-python and 9 php packages (OS's other than debuntu)" - name: "Install packages: mysql, MySQL-python and 9 php packages (OS's other than debuntu)"
package: package:
@ -44,15 +51,12 @@
- php-xmlrpc - php-xmlrpc
state: present state: present
when: not is_debuntu when: not is_debuntu
#tags: download
- include_tasks: centos.yml - include_tasks: centos.yml
when: ansible_distribution == "CentOS" when: ansible_distribution == "CentOS"
#tags: download
- include_tasks: fedora.yml - include_tasks: fedora.yml
when: ansible_distribution == "Fedora" when: ansible_distribution == "Fedora"
#tags: download
# 2019-07-03 @jvonau @holta: the next 50 lines (6 stanzas) double MariaDB's # 2019-07-03 @jvonau @holta: the next 50 lines (6 stanzas) double MariaDB's
@ -110,6 +114,12 @@
# line: "TimeoutStartSec=180" # line: "TimeoutStartSec=180"
when: mariadb_unit_file.stat.exists when: mariadb_unit_file.stat.exists
- name: "Add 'mysql_installed: True' to {{ iiab_state_file }}"
lineinfile:
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^mysql_installed'
line: 'mysql_installed: True'
# Name of MySQL service varies by OS, so hardcoded in /opt/iiab/iiab/vars/<OS>.yml (formerly in roles/0-init/tasks/main.yml) # Name of MySQL service varies by OS, so hardcoded in /opt/iiab/iiab/vars/<OS>.yml (formerly in roles/0-init/tasks/main.yml)
- name: Enable & Start MySQL systemd service ({{ mysql_service }}) if mysql_enabled - name: Enable & Start MySQL systemd service ({{ mysql_service }}) if mysql_enabled
@ -178,6 +188,7 @@
state: stopped state: stopped
when: not mysql_enabled when: not mysql_enabled
- name: Add 'mysql' variable values to {{ iiab_ini_file }} - name: Add 'mysql' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"

View file

@ -1,34 +1,41 @@
### Transition to NGINX ### Transition to NGINX
1. Initial testing strategy is to move NGINX to port 80, and proxy everything to Apache on port 8090 -- creating a shim. 1. Initial testing strategy is to move NGINX to port 80, and proxy everything to Apache on port 8090 &mdash; creating "Shims" for each IIAB App/Service in *Section iii.* below.
Until "Native" NGINX is later implemented for that IIAB App/Service &mdash; allowing it to move up to *Section ii.* below.
And potentially later moving it up to *Section i.* if its Apache support is dropped!
2. Without PHP available via FastCGI, any function at all for PHP-based applications validates NGINX. 2. Without PHP available via FastCGI, any function at all for PHP-based applications validates NGINX.
3. Current state (2020-01-12). 3. Current state IIAB App/Service migrations as of 2020-01-23...
1. Principal functions migrated to NGINX 1. These support "Native" NGINX but ***NOT*** Apache
* Admin Console * Admin Console
* kalite -- goes directly to ports 8006-8008 * captiveportal
* mediawiki
* osm-vector-maps * osm-vector-maps
* RACHEL-like modules
* usb-lib * usb-lib
* wordpress
2. Dual support, see [roles/nginx/tasks/only_nginx.yml](tasks/only_nginx.yml) 2. These support "Native" NGINX ***AND*** Apache, a.k.a. "dual support" for legacy testing (if suitable "Shims" from *Section iii.* below are preserved!) Both "Native" NGINX and "Shim" proxying from NGINX to Apache port 8090 *cannot be enabled simultaneously* for these IIAB Apps/Service. But if you want to attempt their "Shim" proxying legacy testing mode, [auto-enable Apache](../0-init/tasks/main.yml#L40-L44) by setting `nginx_enabled: False` in [/etc/iiab/local_vars.yml](http://wiki.laptop.org/go/IIAB/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F)
* awstats ([#2124](https://github.com/iiab/iiab/issues/2124)) * awstats
* calibre-web * calibre-web
* gitea * gitea
* kiwix -- goes directly to port 3000 * kiwix
* kolibri * kolibri
* mediawiki
* munin
* sugarizer * sugarizer
* wordpress
3. Still proxied to Apache, see [roles/0-init/tasks/main.yml#L108-L112](../0-init/tasks/main.yml#L108-L112) & [roles/nginx/tasks/uses_apache.yml](tasks/uses_apache.yml) 3. These support Apache but ***NOT*** "Native" NGINX. These use a "Shim" to [proxy_pass](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) from NGINX to Apache on port 8090. See [roles/0-init/tasks/main.yml#L40-L44](../0-init/tasks/main.yml#L40-L44) for a list of these IIAB Apps/Services, that auto-enable Apache.
* dokuwiki ([#2056](https://github.com/iiab/iiab/issues/2056)) * dokuwiki ([#2056](https://github.com/iiab/iiab/issues/2056))
* elgg * elgg
* lokole * lokole
* moodle * moodle
* nodered
* nextcloud ([PR #2119](https://github.com/iiab/iiab/pull/2119)) * nextcloud ([PR #2119](https://github.com/iiab/iiab/pull/2119))
* nodered
4. Not yet dealt with 4. Not Yet Dealt With!
* internetarchive ([PR #2120](https://github.com/iiab/iiab/pull/2120)) * internetarchive (menu goes directly to port 4244, [PR #2120](https://github.com/iiab/iiab/pull/2120))
* kalite (menu goes directly to ports 8006-8008)

View file

@ -41,13 +41,22 @@
# /etc/iiab/local_vars.yml -- then re-run this IIAB installer. # /etc/iiab/local_vars.yml -- then re-run this IIAB installer.
# when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stderr == "" # when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stderr == ""
# Forces < 12 or > 12 to be removed, ignored if file is absent
- name: Remove /etc/apt/sources.list.d/nodesource.list if nodejs_version_installed.stdout is not {{ nodejs_version }}
file:
state: absent
path: /etc/apt/sources.list.d/nodesource.list
when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stdout != ""
# BRUTAL but ensures consistency across OS's / distros like Raspbian Desktop & Ubermix that often include an older version of Node.js # BRUTAL but ensures consistency across OS's / distros like Raspbian Desktop & Ubermix that often include an older version of Node.js
# Forces < 12 or > 12 to be uninstalled
- name: ASK apt/yum/dnf TO REMOVE PRE-EXISTING Node.js {{ nodejs_version_installed.stdout }} (IF IT'S NOT {{ nodejs_version }}) - name: ASK apt/yum/dnf TO REMOVE PRE-EXISTING Node.js {{ nodejs_version_installed.stdout }} (IF IT'S NOT {{ nodejs_version }})
package: package:
name: nodejs name: nodejs
state: absent state: absent
when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stdout != "" when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stdout != ""
# Forces == 12
- name: Warn if Node.js {{ nodejs_version}} already installed & might be updated - name: Warn if Node.js {{ nodejs_version}} already installed & might be updated
debug: debug:
msg: "WARN: YOUR Node.js {{ nodejs_version }} MIGHT NOW BE UPDATED USING nodesource.com" msg: "WARN: YOUR Node.js {{ nodejs_version }} MIGHT NOW BE UPDATED USING nodesource.com"
@ -79,6 +88,7 @@
# 19.04 Beta. Comment it out for now, and manually run: "apt install npm" then # 19.04 Beta. Comment it out for now, and manually run: "apt install npm" then
# "npm install -g npm@latest" (all *SHOULD* be magically fixed by 2019-04-18 ?) # "npm install -g npm@latest" (all *SHOULD* be magically fixed by 2019-04-18 ?)
# Forces update
- name: Install latest Node.js {{ nodejs_version }} which includes /usr/bin/npm (debuntu) - name: Install latest Node.js {{ nodejs_version }} which includes /usr/bin/npm (debuntu)
package: package:
#name: nodejs={{ nodejs_version }} #name: nodejs={{ nodejs_version }}
@ -138,3 +148,10 @@
# 2019-03-29: Debian 10 Buster & Ubuntu 19.04 pre-releases made the jump # 2019-03-29: Debian 10 Buster & Ubuntu 19.04 pre-releases made the jump
# thankfully; currently both offer Node.js 10.15.2 # thankfully; currently both offer Node.js 10.15.2
- name: "Add 'nodejs_installed: True' to {{ iiab_state_file }}"
lineinfile:
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^nodejs_installed'
line: 'nodejs_installed: True'

View file

@ -1,2 +0,0 @@
dependencies:
- { role: nodejs, tags: ['nodejs'], when: nodered_install | bool }

View file

@ -1,5 +1,10 @@
# 2019-01-16: @jvonau's PR #1403 moved installation of Node.js (8.x for now) & # 2019-01-16: @jvonau's PR #1403 moved installation of Node.js (8.x for now) &
# npm to roles/nodejs/tasks/main.yml, triggered by roles/nodered/meta/main.yml # npm to roles/nodejs/tasks/main.yml
- name: NODEJS - run the 'nodejs' role
include_role:
name: nodejs
# 2020-01-04 no longer triggered by roles/nodered/meta/main.yml
# BRUTAL but ensures consistency across OS's / distros like Raspbian Desktop & # BRUTAL but ensures consistency across OS's / distros like Raspbian Desktop &
# Ubermix that often include an older version of Node-RED. Brutal, as this # Ubermix that often include an older version of Node-RED. Brutal, as this
@ -75,7 +80,7 @@
- name: Install /etc/systemd/system/nodered.service systemd unit file from template - name: Install /etc/systemd/system/nodered.service systemd unit file from template
template: template:
backup: yes backup: no
src: nodered.service.j2 src: nodered.service.j2
dest: /etc/systemd/system/nodered.service dest: /etc/systemd/system/nodered.service
# mode: '0666' # mode: '0666'

View file

@ -1,9 +1,8 @@
# TO DO: WRAP 10 OR 11 STANZAS BELOW (and saving vars to iiab_ini_file at # TO DO: WRAP 11 OR 12 STANZAS BELOW INTO install.yml, conditioned by...
# bottom) INTO install.yml, somehow conditioned by... # 'when: openvpn_installed is undefined'
# when: openvpn_install | bool
# #
# BEWARE: 11th stanza (ssh pubkey deletions) is already conditioned by... # BEWARE: 4th stanza (ssh pubkey deletions) is already conditioned by...
# when: not openvpn_install # 'when: not openvpn_install' (revise?)
- name: Install OpenVPN and Nmap packages - name: Install OpenVPN and Nmap packages
package: package:
@ -84,30 +83,37 @@
dest: /usr/bin/ dest: /usr/bin/
mode: '0755' mode: '0755'
- name: Create iiab-support-on (symlink to iiab-support for now) - name: Symlink /usr/bin/iiab-support-on -> /usr/bin/iiab-support
file: file:
src: /usr/bin/iiab-support src: /usr/bin/iiab-support
path: /usr/bin/iiab-support-on path: /usr/bin/iiab-support-on
state: link state: link
- name: Create iiab-support-off (symlink to iiab-remote-off for now) - name: Symlink /usr/bin/iiab-support-off -> /usr/bin/iiab-remote-off
file: file:
src: /usr/bin/iiab-remote-off src: /usr/bin/iiab-remote-off
path: /usr/bin/iiab-support-off path: /usr/bin/iiab-support-off
state: link state: link
- name: Create iiab-vpn-on (symlink to iiab-remote-on for now) - name: Symlink /usr/bin/iiab-vpn-on -> /usr/bin/iiab-remote-on
file: file:
src: /usr/bin/iiab-remote-on src: /usr/bin/iiab-remote-on
path: /usr/bin/iiab-vpn-on path: /usr/bin/iiab-vpn-on
state: link state: link
- name: Create iiab-vpn-off (symlink to iiab-remote-off for now) - name: Symlink /usr/bin/iiab-vpn-off -> /usr/bin/iiab-remote-off
file: file:
src: /usr/bin/iiab-remote-off src: /usr/bin/iiab-remote-off
path: /usr/bin/iiab-vpn-off path: /usr/bin/iiab-vpn-off
state: link state: link
- name: "Add 'openvpn_installed: True' to {{ iiab_state_file }}"
lineinfile:
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^openvpn_installed'
line: 'openvpn_installed: True'
# TO DO: WRAP COMMENTS + 4 ACTIVE STANZAS BELOW INTO enable.yml... # TO DO: WRAP COMMENTS + 4 ACTIVE STANZAS BELOW INTO enable.yml...
# FIXED SOMETIME PRIOR TO AUGUST 2018: earlier versions of Ansible had not # FIXED SOMETIME PRIOR TO AUGUST 2018: earlier versions of Ansible had not
@ -147,7 +153,7 @@
# /lib/systemd/systemd-sysv-install sets /etc/rc*.d/S|K01openvpn # /lib/systemd/systemd-sysv-install sets /etc/rc*.d/S|K01openvpn
# e.g. when "systemctl enable openvpn" # e.g. when "systemctl enable openvpn"
- name: Enable & (Re)Start PARENT service openvpn, which (re)starts CHILD service openvpn@xscenet (& actual tunnel) - name: Enable & (Re)Start PARENT 'openvpn' system service, which (re)starts CHILD service 'openvpn@xscenet' (& actual tunnel)
systemd: systemd:
name: openvpn name: openvpn
daemon_reload: yes daemon_reload: yes
@ -171,7 +177,7 @@
state: absent state: absent
when: not openvpn_enabled or not openvpn_cron_enabled when: not openvpn_enabled or not openvpn_cron_enabled
- name: Disable & Stop PARENT service openvpn, which stops CHILD service openvpn@xscenet (& actual tunnel) - name: Disable & Stop PARENT 'openvpn' system service, which stops CHILD service 'openvpn@xscenet' (& actual tunnel)
systemd: systemd:
name: openvpn name: openvpn
enabled: no enabled: no
@ -191,6 +197,7 @@
# ignore_errors: True # ignore_errors: True
# when: not openvpn_enabled and not installing # when: not openvpn_enabled and not installing
- name: Add 'openvpn' variable values to {{ iiab_ini_file }} - name: Add 'openvpn' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"

View file

@ -1,9 +1,18 @@
- name: "Set PostgreSQL vars 'postgresql_install: True' and 'postgresql_enabled: True'"
set_fact:
postgresql_install: True
postgresql_enabled: True
- name: POSTGRESQL - run the 'postgresql' role
include_role:
name: postgresql
- name: Remove package Pathagar (in case rpm?) - name: Remove package Pathagar (in case rpm?)
package: package:
name: pathagar name: pathagar
state: absent state: absent
- name: Install Pathagar prerequisites (all OSs) - name: "Install Pathagar prerequisites: python-virtualenv, python-pip, python-psycopg2"
package: package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
@ -12,7 +21,7 @@
- python-pip - python-pip
- python-psycopg2 - python-psycopg2
- name: Install Pathagar prerequisites (debuntu) - name: "Install Pathagar prerequisites: libapache2-mod-wsgi, libxml2-dev, libxslt-dev (debuntu)"
package: package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
@ -22,7 +31,7 @@
- libxslt-dev - libxslt-dev
when: is_debuntu | bool when: is_debuntu | bool
- name: Install Pathagar prerequisites (not debuntu) - name: "Install Pathagar prerequisites: mod_wsgi, libxml2-devel, libxslt-devel (not debuntu)"
package: package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
@ -32,21 +41,21 @@
- libxslt-devel - libxslt-devel
when: not is_debuntu when: not is_debuntu
- name: Create destination folder - name: "Create destination folder: {{ pathagar_src }}"
file: file:
path: "{{ pathagar_src }}" path: "{{ pathagar_src }}"
state: directory state: directory
owner: root # owner: root
group: root # group: root
mode: 0755 # mode: '0755'
- name: Create books destination folder - name: "Create books destination folder: {{ pathagar_media }}"
file: file:
path: "{{ pathagar_media }}" path: "{{ pathagar_media }}"
state: directory state: directory
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
group: "{{ apache_user }}" group: "{{ apache_user }}"
mode: 0755 mode: '0755'
- name: Determine if Pathagar has already been downloaded from git - name: Determine if Pathagar has already been downloaded from git
stat: stat:
@ -89,10 +98,12 @@
become: yes become: yes
become_user: postgres become_user: postgres
- name: Start postgresql-iiab - name: Start 'postgresql-iiab' systemd service
service: systemd:
name: postgresql-iiab name: postgresql-iiab
state: started state: started
enabled: yes
when: pathagar_enabled
- name: Enable Pathagar postgresql user access by md5 method - name: Enable Pathagar postgresql user access by md5 method
lineinfile: lineinfile:
@ -106,8 +117,8 @@
group: postgres group: postgres
register: enable_pathagar_md5_access register: enable_pathagar_md5_access
- name: Reload postgresql service - name: Reload 'postgresql-iiab' systemd service
service: systemd:
name: postgresql-iiab name: postgresql-iiab
state: reloaded state: reloaded
when: enable_pathagar_md5_access.changed when: enable_pathagar_md5_access.changed
@ -126,9 +137,9 @@
template: template:
src: prod_settings.py src: prod_settings.py
dest: "{{ pathagar_src }}/prod_settings.py" dest: "{{ pathagar_src }}/prod_settings.py"
owner: root # owner: root
group: root # group: root
mode: 0644 # mode: '0644'
- name: Create Pathagar initial db - name: Create Pathagar initial db
django_manage: django_manage:
@ -143,7 +154,7 @@
dest: "{{ pathagar_dir }}/auth.User.json" dest: "{{ pathagar_dir }}/auth.User.json"
owner: root owner: root
group: root group: root
mode: 0600 mode: '0600'
- name: Load Pathagar admin user - name: Load Pathagar admin user
django_manage: django_manage:
@ -164,35 +175,44 @@
template: template:
src: wsgi.py src: wsgi.py
dest: "{{ pathagar_dir }}/wsgi.py" dest: "{{ pathagar_dir }}/wsgi.py"
owner: root # owner: root
group: root # group: root
mode: 0644 # mode: '0644'
- name: Install httpd conf for Pathagar - name: Install /etc/{{ apache_config_dir }}/pathagar.conf from template
template: template:
src: pathagar.conf src: pathagar.conf
backup: yes backup: yes
dest: "/etc/{{ apache_config_dir }}/pathagar.conf" dest: "/etc/{{ apache_config_dir }}/pathagar.conf"
mode: 0644 mode: 0644
- name: Enable Pathagar (debuntu) - name: Enable Pathagar via Apache (debuntu)
file: file:
path: /etc/apache2/sites-enabled/pathagar.conf path: /etc/apache2/sites-enabled/pathagar.conf
src: /etc/apache2/sites-available/pathagar.conf src: /etc/apache2/sites-available/pathagar.conf
state: link state: link
when: pathagar_enabled and is_debuntu when: pathagar_enabled and is_debuntu
- name: Disable Pathagar (debuntu) - name: Disable Pathagar via Apache (debuntu)
file: file:
path: /etc/apache2/sites-enabled/pathagar.conf path: /etc/apache2/sites-enabled/pathagar.conf
state: absent state: absent
when: not pathagar_enabled and is_debuntu when: not pathagar_enabled and is_debuntu
- name: Reload Apache ({{ apache_service }}) - name: Reload '{{ apache_service }}' systemd service
systemd: systemd:
name: "{{ apache_service }}" name: "{{ apache_service }}"
state: reloaded state: reloaded
# if the only service using the backend db disable if not running
- name: Disable 'postgresql-iiab' systemd service, if not moodle_enabled and not pathagar_enabled
systemd:
name: postgresql-iiab
state: stopped
enabled: no
when: not moodle_enabled and not pathagar_enabled
- name: Add 'pathagar' variable values to {{ iiab_ini_file }} - name: Add 'pathagar' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"

View file

@ -1,3 +0,0 @@
dependencies:
- { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x")}

View file

@ -1,3 +1,7 @@
- name: NODEJS - run the 'nodejs' role
include_role:
name: nodejs
- name: Fail if nodejs_version is incorrect - name: Fail if nodejs_version is incorrect
fail: fail:
msg: >- msg: >-

View file

@ -3,7 +3,6 @@
url: "{{ iiab_download_url }}/{{ phpmyadmin_name_zip }}" url: "{{ iiab_download_url }}/{{ phpmyadmin_name_zip }}"
dest: "{{ downloads_dir }}" dest: "{{ downloads_dir }}"
timeout: "{{ download_timeout }}" timeout: "{{ download_timeout }}"
#register: phpmyadmin_dl_output
when: internet_available | bool when: internet_available | bool
- name: Does {{ downloads_dir }}/{{ phpmyadmin_name_zip }} exist? # e.g. /opt/iiab/downloads/phpMyAdmin-4.8.3-all-languages.zip - name: Does {{ downloads_dir }}/{{ phpmyadmin_name_zip }} exist? # e.g. /opt/iiab/downloads/phpMyAdmin-4.8.3-all-languages.zip
@ -16,20 +15,20 @@
msg: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }} is REQUIRED in order to install phpMyAdmin." msg: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }} is REQUIRED in order to install phpMyAdmin."
when: not phpmyadmin_dl.stat.exists when: not phpmyadmin_dl.stat.exists
- name: Unzip to permanent location /opt/{{ phpmyadmin_name }} - name: Unzip to permanent location /opt/{{ phpmyadmin_name }}, owned by {{ apache_user }}
unarchive: unarchive:
src: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}" src: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}"
dest: /opt dest: /opt
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
- name: Create symlink from /opt/phpmyadmin to {{ phpmyadmin_name }} - name: Symlink /opt/phpmyadmin -> {{ phpmyadmin_name }}
file: file:
src: "{{ phpmyadmin_name }}" src: "{{ phpmyadmin_name }}"
path: /opt/phpmyadmin path: /opt/phpmyadmin
owner: "{{ apache_user }}" owner: "{{ apache_user }}" # Some Linux's ignore symlink owners?
state: link state: link
- name: Install /opt/phpmyadmin/config.inc.php from template - name: Install /opt/phpmyadmin/config.inc.php owned by {{ apache_user }}, from template
template: template:
src: config.inc.php src: config.inc.php
dest: /opt/phpmyadmin/config.inc.php dest: /opt/phpmyadmin/config.inc.php
@ -46,6 +45,13 @@
# # recurse: yes # # recurse: yes
# # state: directory # # state: directory
- name: "Add 'phpmyadmin_installed: True' to {{ iiab_state_file }}"
lineinfile:
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^phpmyadmin_installed'
line: 'phpmyadmin_installed: True'
- name: Install /etc/{{ apache_config_dir }}/phpmyadmin.conf from template, if phpmyadmin_enabled - name: Install /etc/{{ apache_config_dir }}/phpmyadmin.conf from template, if phpmyadmin_enabled
template: template:
src: phpmyadmin.j2 src: phpmyadmin.j2
@ -65,6 +71,7 @@
state: absent state: absent
when: not phpmyadmin_enabled and is_debuntu when: not phpmyadmin_enabled and is_debuntu
- name: Add 'phpmyadmin' variable values to {{ iiab_ini_file }} - name: Add 'phpmyadmin' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"

View file

@ -1,30 +1,32 @@
- name: Install postgresql package # TO DO:
# - Validate input vars postgresql_install & postgresql_enabled
# - Put ~12 stanzas just below into install.yml
# - Triggered by... 'when: postgresql_installed is undefined'
- name: Install 'postgresql' package
package: package:
name: postgresql name: postgresql
state: present state: present
#tags: download
- name: Install postgresql-client (debuntu) - name: Install 'postgresql-client' package (debuntu)
package: package:
name: postgresql-client name: postgresql-client
state: present state: present
when: is_debuntu | bool when: is_debuntu | bool
#tags: download
- name: Install postgresql-server (OS's other than debuntu) - name: Install 'postgresql-server' package (OS's other than debuntu)
package: package:
name: postgresql-server name: postgresql-server
state: present state: present
when: not is_debuntu when: not is_debuntu
#tags: download
- name: Install /etc/systemd/system/postgresql-iiab.service from template - name: Install /etc/systemd/system/postgresql-iiab.service from template
template: template:
src: postgresql-iiab.service src: postgresql-iiab.service
dest: /etc/systemd/system/postgresql-iiab.service dest: /etc/systemd/system/postgresql-iiab.service
owner: root # owner: root
group: root # group: root
mode: '0644' # mode: '0644'
- name: Create PostgreSQL data dir /library/pgsql-iiab, owned by postgres:postgres - name: Create PostgreSQL data dir /library/pgsql-iiab, owned by postgres:postgres
file: file:
@ -71,26 +73,32 @@
group: postgres group: postgres
mode: '0640' mode: '0640'
# Probably Not Nec! Given stanza below does the same. # Likely No Longer Nec! Given stanza below does the same...
- name: 'Stop postgresql service: /etc/init.d/postgresql stop (debuntu)' #- name: 'Stop postgresql service: /etc/init.d/postgresql stop (debuntu)'
command: "/etc/init.d/postgresql stop" # command: "/etc/init.d/postgresql stop"
ignore_errors: True # ignore_errors: True
when: postgresql_install and is_debuntu # when: postgresql_install and is_debuntu
- name: Disable stock postgresql service - name: Disable & Stop stock 'postgresql' systemd service
systemd: systemd:
name: postgresql name: postgresql
state: stopped state: stopped
enabled: no enabled: no
- name: Enable & Start postgresql-iiab systemd service, if postgresql_enabled - name: "Add 'postgresql_installed: True' to {{ iiab_state_file }}"
lineinfile:
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^postgresql_installed'
line: 'postgresql_installed: True'
- name: Enable & Start 'postgresql-iiab' systemd service, if 'postgresql_enabled'
systemd: systemd:
name: postgresql-iiab name: postgresql-iiab
state: started state: started
enabled: yes enabled: yes
when: postgresql_enabled | bool when: postgresql_enabled | bool
- name: Disable postgresql-iiab service, if not postgresql_enabled - name: Disable 'postgresql-iiab' systemd service, if not 'postgresql_enabled'
systemd: systemd:
name: postgresql-iiab name: postgresql-iiab
state: stopped state: stopped

View file

@ -1,3 +0,0 @@
dependencies:
- { role: mongodb, tags: ['generic','mongodb'], when: sugarizer_install | bool }
- { role: nodejs, tags: ['nodejs'], when: sugarizer_install | bool }

View file

@ -1,3 +1,4 @@
# auto starts mongodb via the requires= line in unit file
- name: Enable & Restart 'sugarizer' systemd service - name: Enable & Restart 'sugarizer' systemd service
systemd: systemd:
name: sugarizer name: sugarizer
@ -6,6 +7,7 @@
state: restarted state: restarted
when: sugarizer_enabled | bool when: sugarizer_enabled | bool
# stops sugarizer but not mongodb
- name: Disable & Stop 'sugarizer' systemd service - name: Disable & Stop 'sugarizer' systemd service
systemd: systemd:
name: sugarizer name: sugarizer
@ -13,6 +15,11 @@
state: stopped state: stopped
when: not sugarizer_enabled when: not sugarizer_enabled
# stops mongodb would of been called via meta/main.yml prior
- name: Run mongodb/tasks/enable.yml to stop MongoDB, if not sugarizer_enabled
include_tasks: roles/mongodb/tasks/enable.yml
when: not sugarizer_enabled
# Apache # Apache
- name: Enable http://box/sugarizer & http://box/sugar via Apache - name: Enable http://box/sugarizer & http://box/sugar via Apache

View file

@ -1,3 +1,11 @@
- name: MONGODB - run the 'mongodb' role
include_role:
name: mongodb
- name: NODEJS - run the 'nodejs' role
include_role:
name: nodejs
- name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 12.x - name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 12.x
fail: fail:
msg: "Sugarizer install cannot proceed, as it currently requires Node.js 12.x, and your nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml and possibly also /etc/iiab/local_vars.yml" msg: "Sugarizer install cannot proceed, as it currently requires Node.js 12.x, and your nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml and possibly also /etc/iiab/local_vars.yml"

View file

@ -5,15 +5,15 @@
- transmission-cli - transmission-cli
state: present state: present
- name: Create download dir {{ transmission_download_dir }}, owned by {{ transmission_user }}:{{ transmission_group }} # /library/transmission - name: Create download dir {{ transmission_download_dir }}, owned by {{ transmission_user }}:{{ transmission_group }}
file: file:
path: "{{ transmission_download_dir }}" path: "{{ transmission_download_dir }}" # /library/transmission
owner: "{{ transmission_user }}" owner: "{{ transmission_user }}" # debian-transmission
group: "{{ transmission_group }}" group: "{{ transmission_group }}" # root
mode: 0755 # mode: '0755'
state: directory state: directory
- name: Stop transmission-daemon before modifying its settings - name: Stop 'transmission-daemon' systemd service, before modifying its settings
systemd: systemd:
name: transmission-daemon name: transmission-daemon
state: stopped state: stopped
@ -23,11 +23,18 @@
template: template:
src: settings.json.j2 src: settings.json.j2
dest: /etc/transmission-daemon/settings.json dest: /etc/transmission-daemon/settings.json
mode: 0644 # mode: '0644'
owner: "{{ transmission_user }}" owner: "{{ transmission_user }}" # debian-transmission
group: "{{ transmission_group }}" group: "{{ transmission_group }}" # root
- name: Enable & Restart transmission-daemon systemd service, incl daemon-reload - name: "Add 'transmission_installed: True' to {{ iiab_state_file }}"
lineinfile:
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^transmission_installed'
line: 'transmission_installed: True'
- name: Enable & Restart 'transmission-daemon' systemd service, incl daemon-reload
systemd: systemd:
name: transmission-daemon name: transmission-daemon
daemon_reload: yes daemon_reload: yes
@ -45,7 +52,7 @@
when: transmission_enabled and transmission_provision and transmission_kalite_languages is defined and transmission_kalite_languages is not none when: transmission_enabled and transmission_provision and transmission_kalite_languages is defined and transmission_kalite_languages is not none
ignore_errors: yes ignore_errors: yes
- name: Disable transmission-daemon service, if not transmission_enabled - name: Disable & Stop 'transmission-daemon' service, if not transmission_enabled
systemd: systemd:
name: transmission-daemon name: transmission-daemon
daemon_reload: yes daemon_reload: yes
@ -53,6 +60,7 @@
state: stopped state: stopped
when: not transmission_enabled when: not transmission_enabled
- name: Add 'transmission' variable values to {{ iiab_ini_file }} - name: Add 'transmission' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"

View file

@ -19,12 +19,21 @@
shell: /usr/bin/vnstat -i {{ iiab_lan_iface }} shell: /usr/bin/vnstat -i {{ iiab_lan_iface }}
when: iiab_lan_iface is defined when: iiab_lan_iface is defined
- name: Enable & Start vnStat's systemd service - name: "Add 'vnstat_installed: True' to {{ iiab_state_file }}"
lineinfile:
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^vnstat_installed'
line: 'vnstat_installed: True'
- name: Enable & Start vnStat's systemd service (vnstat)
systemd: systemd:
name: vnstat name: vnstat
daemon_reload: yes daemon_reload: yes
enabled: yes enabled: yes
state: started state: restarted
when: vnstat_enabled | bool
- name: Add 'vnstat' variable values to {{ iiab_ini_file }} - name: Add 'vnstat' variable values to {{ iiab_ini_file }}
ini_file: ini_file:

View file

@ -0,0 +1,12 @@
- name: Enable http://box{{ wp_url }} via Apache # http://box/wordpress
command: a2ensite wordpress.conf
when: wordpress_enabled
- name: Disable http://box{{ wp_url }} via Apache # http://box/wordpress
command: a2dissite wordpress.conf
when: not wordpress_enabled
- name: Restart '{{ apache_service }}' systemd service
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted

View file

@ -1,35 +0,0 @@
# Apache
- name: Enable http://box{{ wp_url }} via Apache
command: a2ensite wordpress.conf
when: apache_install and wordpress_enabled
- name: Disable http://box{{ wp_url }} via Apache
command: a2dissite wordpress.conf
when: apache_install and not wordpress_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted
when: apache_install and apache_enabled
# NGINX
- name: Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template
template:
src: wordpress-nginx.conf.j2
dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" # /etc/nginx/conf.d
when: wordpress_enabled # and nginx_enabled
- name: Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf
file:
path: "{{ nginx_config_dir }}/wordpress-nginx.conf" # /etc/nginx/conf.d
state: absent
when: not wordpress_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted
#when: nginx_enabled | bool

View file

@ -4,7 +4,7 @@
# I want to perform input validation for Ansible playbooks" # I want to perform input validation for Ansible playbooks"
# https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499 # https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499
# If 0-init/tasks/validate_vars.yml has DEFINITELY been run (?) perhaps no need # We assume 0-init/tasks/validate_vars.yml has DEFINITELY been run, so no need
# to re-check whether vars are defined here. As Ansible vars cannot be unset: # to re-check whether vars are defined here. As Ansible vars cannot be unset:
# https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible # https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible
@ -13,16 +13,13 @@
that: wordpress_install is sameas true that: wordpress_install is sameas true
fail_msg: "PLEASE SET 'wordpress_install: True' e.g. IN: /etc/iiab/local_vars.yml" fail_msg: "PLEASE SET 'wordpress_install: True' e.g. IN: /etc/iiab/local_vars.yml"
quiet: yes quiet: yes
#that: wordpress_install is defined and wordpress_install is sameas true
#success_msg: wordpress_install is defined and wordpress_install is sameas true
- name: Assert that "wordpress_enabled | type_debug == 'bool'" (boolean not string etc) - name: Assert that "wordpress_enabled | type_debug == 'bool'" (boolean not string etc)
assert: assert:
that: wordpress_enabled | type_debug == 'bool' that: wordpress_enabled | type_debug == 'bool'
fail_msg: "PLEASE GIVE VARIABLE 'wordpress_enabled' A PROPER (UNQUOTED) BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" fail_msg: "PLEASE GIVE VARIABLE 'wordpress_enabled' A PROPER (UNQUOTED) BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml"
quiet: yes quiet: yes
#that: wordpress_enabled is defined and wordpress_enabled | type_debug == 'bool'
#success_msg: wordpress_enabled is defined and wordpress_enabled | type_debug == 'bool'
- name: Provision MySQL DB for WordPress, if 'wordpress_installed' is not defined in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - name: Provision MySQL DB for WordPress, if 'wordpress_installed' is not defined in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: setup.yml include_tasks: setup.yml
@ -32,8 +29,15 @@
include_tasks: install.yml include_tasks: install.yml
when: wordpress_installed is undefined when: wordpress_installed is undefined
- name: Enable or Disable WordPress
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: Add 'wordpress' variable values to {{ iiab_ini_file }} - name: Add 'wordpress' variable values to {{ iiab_ini_file }}
ini_file: ini_file:

View file

@ -0,0 +1,16 @@
- name: Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template
template:
src: wordpress-nginx.conf.j2
dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" # /etc/nginx/conf.d
when: wordpress_enabled
- name: Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf
file:
path: "{{ nginx_config_dir }}/wordpress-nginx.conf" # /etc/nginx/conf.d
state: absent
when: not wordpress_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted

View file

@ -64,6 +64,8 @@ if [ "$REINSTALL" == "1" ]; then
if [ ! $1 == "internetarchive" ]; then # special handling if [ ! $1 == "internetarchive" ]; then # special handling
if [ $1 == "calibre-web" ]; then # role directory & installed marker differ if [ $1 == "calibre-web" ]; then # role directory & installed marker differ
sed -i -e '/^calibreweb/d' $IIAB_STATE_FILE sed -i -e '/^calibreweb/d' $IIAB_STATE_FILE
elif [ $1 == "httpd" ]; then # role directory & installed marker differ
sed -i -e '/^apache/d' $IIAB_STATE_FILE
elif [ $1 == "osm-vector-maps" ]; then # role directory & installed marker differ elif [ $1 == "osm-vector-maps" ]; then # role directory & installed marker differ
sed -i -e '/^osm_vector_maps/d' $IIAB_STATE_FILE sed -i -e '/^osm_vector_maps/d' $IIAB_STATE_FILE
#elif [ $1 == "bluetooth" ]; then # role directory & installed marker differ #elif [ $1 == "bluetooth" ]; then # role directory & installed marker differ