diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index b7dd56855..f4bdae83b 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -21,7 +21,7 @@ - name: MOODLE include_role: name: moodle - when: moodle_install and not is_ubuntu_2204 and not is_ubuntu_2210 # TEMPORARY + when: moodle_install # and not is_ubuntu_2204 and not is_ubuntu_2210 # TEMPORARY - name: OSM-VECTOR-MAPS include_role: @@ -43,7 +43,7 @@ - name: SUGARIZER include_role: name: sugarizer - when: sugarizer_install and not is_ubuntu_2204 and not is_ubuntu_2210 # TEMPORARY + when: sugarizer_install # and not is_ubuntu_2204 and not is_ubuntu_2210 # TEMPORARY - name: Recording STAGE 7 HAS COMPLETED ======================== lineinfile: diff --git a/roles/lokole/tasks/main.yml b/roles/lokole/tasks/main.yml index 75cc0cc53..45d47d129 100644 --- a/roles/lokole/tasks/main.yml +++ b/roles/lokole/tasks/main.yml @@ -19,53 +19,62 @@ quiet: yes -- name: Install Lokole if lokole_installed is not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - include_tasks: install.yml - when: lokole_installed is undefined +- block: + + - name: Install Lokole if lokole_installed is not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml + include_tasks: install.yml + when: lokole_installed is undefined -- name: Do a 'systemctl daemon-reload' - systemd: - daemon_reload: yes - when: lokole_enabled + - name: Do a 'systemctl daemon-reload' + systemd: + daemon_reload: yes + when: lokole_enabled -- name: Enable & Restart supervisor systemd service, if lokole_enabled - systemd: - name: supervisor - enabled: yes - state: restarted - when: lokole_enabled + - name: Enable & Restart supervisor systemd service, if lokole_enabled + systemd: + name: supervisor + enabled: yes + state: restarted + when: lokole_enabled -- name: Disable & Stop supervisor systemd service, if not lokole_enabled - systemd: - name: supervisor - enabled: no - state: stopped - when: not lokole_enabled + - name: Disable & Stop supervisor systemd service, if not lokole_enabled + systemd: + name: supervisor + enabled: no + state: stopped + when: not lokole_enabled -- name: Enable/Disable/Restart NGINX - include_tasks: nginx.yml + - name: Enable/Disable/Restart NGINX + include_tasks: nginx.yml -- name: Add 'lokole' variable values to {{ iiab_ini_file }} - ini_file: - path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini - section: lokole - option: "{{ item.option }}" - value: "{{ item.value | string }}" - with_items: - - option: name - value: Lokole - - option: description - value: '"Lokole is an email service that works offline, for rural communities. With a 3G/4G modem, you can arrange to batch-upload / batch-download emails once per night -- for almost no cost at all -- depending on mobile data plans in your country."' - #value: '"Lokole is an email service that works offline, for rural communities. In some cases, emails can also be transmitted to/from the Internet, taking advantage of discounted mobile data rates."' - - option: lokole_install - value: "{{ lokole_install }}" - - option: lokole_enabled - value: "{{ lokole_enabled }}" - - option: lokole_settings - value: "{{ lokole_settings }}" - - option: lokole_url - value: "{{ lokole_url }}" - - option: lokole_full_url - value: "{{ lokole_full_url }}" + - name: Add 'lokole' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini + section: lokole + option: "{{ item.option }}" + value: "{{ item.value | string }}" + with_items: + - option: name + value: Lokole + - option: description + value: '"Lokole is an email service that works offline, for rural communities. With a 3G/4G modem, you can arrange to batch-upload / batch-download emails once per night -- for almost no cost at all -- depending on mobile data plans in your country."' + #value: '"Lokole is an email service that works offline, for rural communities. In some cases, emails can also be transmitted to/from the Internet, taking advantage of discounted mobile data rates."' + - option: lokole_install + value: "{{ lokole_install }}" + - option: lokole_enabled + value: "{{ lokole_enabled }}" + - option: lokole_settings + value: "{{ lokole_settings }}" + - option: lokole_url + value: "{{ lokole_url }}" + - option: lokole_full_url + value: "{{ lokole_full_url }}" + + rescue: + + - name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})' + fail: + msg: "" + when: not skip_role_on_error diff --git a/roles/mongodb/tasks/main.yml b/roles/mongodb/tasks/main.yml index b728aac82..f2ce63d49 100644 --- a/roles/mongodb/tasks/main.yml +++ b/roles/mongodb/tasks/main.yml @@ -44,29 +44,37 @@ # ELSE... -- name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - include_tasks: install.yml - when: mongodb_installed is undefined - # when: mongodb_installed is undefined and not (ansible_architecture == "aarch64" and is_debian_10 and not is_raspbian) +- block: -- name: Enable or Disable MongoDB, if mongodb_installed is defined (sugarizer.service auto-starts MongoDB as nec, so doesn't need this or care what happens here!) - include_tasks: enable-or-disable.yml - when: mongodb_installed is defined + - name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml + include_tasks: install.yml + when: mongodb_installed is undefined + # when: mongodb_installed is undefined and not (ansible_architecture == "aarch64" and is_debian_10 and not is_raspbian) + - name: Enable or Disable MongoDB, if mongodb_installed is defined (sugarizer.service auto-starts MongoDB as nec, so doesn't need this or care what happens here!) + include_tasks: enable-or-disable.yml + when: mongodb_installed is defined -- name: Add 'mongodb' variable values to {{ iiab_ini_file }} - ini_file: - path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini - section: mongodb - option: "{{ item.option }}" - value: "{{ item.value | string }}" - with_items: - - option: name - value: MongoDB - - option: description - value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."' - - option: mongodb_install - value: "{{ mongodb_install }}" - - option: mongodb_enabled - value: "{{ mongodb_enabled }}" + - name: Add 'mongodb' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini + section: mongodb + option: "{{ item.option }}" + value: "{{ item.value | string }}" + with_items: + - option: name + value: MongoDB + - option: description + value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."' + - option: mongodb_install + value: "{{ mongodb_install }}" + - option: mongodb_enabled + value: "{{ mongodb_enabled }}" + + rescue: + + - name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})' + fail: + msg: "" + when: not skip_role_on_error diff --git a/roles/moodle/tasks/main.yml b/roles/moodle/tasks/main.yml index 56289248c..aeb40556f 100644 --- a/roles/moodle/tasks/main.yml +++ b/roles/moodle/tasks/main.yml @@ -19,28 +19,35 @@ quiet: yes -- name: Install Moodle if 'moodle_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - include_tasks: install.yml - when: moodle_installed is undefined +- block: + - name: Install Moodle if 'moodle_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml + include_tasks: install.yml + when: moodle_installed is undefined -- include_tasks: enable-or-disable.yml + - include_tasks: enable-or-disable.yml + - name: Add 'moodle' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini + section: moodle + option: "{{ item.option }}" + value: "{{ item.value | string }}" + with_items: + - option: name + value: Moodle + - option: description + value: '"Access the Moodle learning management system."' + - option: moodle_install + value: "{{ moodle_install }}" + - option: moodle_enabled + value: "{{ moodle_enabled }}" + - option: moodle_base + value: "{{ moodle_base }}" -- name: Add 'moodle' variable values to {{ iiab_ini_file }} - ini_file: - path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini - section: moodle - option: "{{ item.option }}" - value: "{{ item.value | string }}" - with_items: - - option: name - value: Moodle - - option: description - value: '"Access the Moodle learning management system."' - - option: moodle_install - value: "{{ moodle_install }}" - - option: moodle_enabled - value: "{{ moodle_enabled }}" - - option: moodle_base - value: "{{ moodle_base }}" + rescue: + + - name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})' + fail: + msg: "" + when: not skip_role_on_error diff --git a/roles/sugarizer/tasks/main.yml b/roles/sugarizer/tasks/main.yml index e1e6b825b..d0c2ac55a 100644 --- a/roles/sugarizer/tasks/main.yml +++ b/roles/sugarizer/tasks/main.yml @@ -19,39 +19,53 @@ quiet: yes -# 3 stanzas moved up from install.yml, so Debian-or-any-OS-where-MongoDB-fails -# still finish their "LARGE-sized" IIAB install: (WITH LOUD RED WARNINGS!) +- block: -- name: "Set 'mongodb_install: True'" - set_fact: - mongodb_install: True + # 3 stanzas moved up from install.yml, so Debian-or-any-OS-where-MongoDB-fails + # still finish their "LARGE-sized" IIAB install: (WITH LOUD RED WARNINGS!) -- name: 'CAUTION: IF ''mongodb.service'' IS STOPPED FOR ANY REASON, IT WILL IMMEDIATELY CAUSE SUGARIZER TO FAIL ("502 Bad Gateway") !' - debug: - msg: "/etc/systemd/system/sugarizer.service Line 4 'Requires=mongodb.service' tries to auto-start MongoDB every time Sugarizer starts. IIAB (roles/mongodb/tasks/enable-or-disable.yml) tries its best to keep Ansible var 'mongodb_enabled' in sync with its systemd equivalent, i.e. the output of 'systemctl is-enabled mongodb' (as of 2020-10-29 both are typically disabled, unless other apps/services/operators choose to use MongoDB)." + - name: "Set 'mongodb_install: True'" + set_fact: + mongodb_install: True -- name: MONGODB - run 'mongodb' role (attempt to install MongoDB) - include_role: - name: mongodb + - name: 'CAUTION: IF ''mongodb.service'' IS STOPPED FOR ANY REASON, IT WILL IMMEDIATELY CAUSE SUGARIZER TO FAIL ("502 Bad Gateway") !' + debug: + msg: "/etc/systemd/system/sugarizer.service Line 4 'Requires=mongodb.service' tries to auto-start MongoDB every time Sugarizer starts. IIAB (roles/mongodb/tasks/enable-or-disable.yml) tries its best to keep Ansible var 'mongodb_enabled' in sync with its systemd equivalent, i.e. the output of 'systemctl is-enabled mongodb' (as of 2020-10-29 both are typically disabled, unless other apps/services/operators choose to use MongoDB)." + + - name: MONGODB - run 'mongodb' role (attempt to install MongoDB) + include_role: + name: mongodb -- name: EXIT 'sugarizer' ROLE & CONTINUE, IF 'mongodb_installed is undefined' - fail: # FORCE IT RED THIS ONCE! - msg: MongoDB INSTALLATION FAILED, perhaps because your OS is Debian 10 on aarch64? Nevertheless IIAB will continue (consider this a warning!) - when: mongodb_installed is undefined - ignore_errors: yes + # - name: EXIT 'sugarizer' ROLE & CONTINUE, IF 'mongodb_installed is undefined' + # fail: # FORCE IT RED THIS ONCE! + # msg: MongoDB INSTALLATION FAILED, perhaps because MongoDB doesn't yet support Ubuntu 22.04 with libssl3? Nevertheless IIAB will continue (consider this a warning!) + # when: mongodb_installed is undefined + # ignore_errors: yes # RESCUE (BELOW) NOW HANDLES THIS -# ELSE... + - name: Verify that mongodb_installed is defined + fail: + msg: MongoDB INSTALLATION FAILED, perhaps because MongoDB doesn't yet support Ubuntu 22.04 with libssl3? #3190 + when: mongodb_installed is undefined -- name: Install/Enable/Disable/Record Sugarizer (main2.yml) IF 'mongodb_installed is defined' - include_tasks: main2.yml - when: mongodb_installed is defined + # ELSE... -# THE block: APPROACH BELOW WORKS JUST LIKE main2.yml ABOVE. -# BUT IT VISUALLY POLLUTES: MANY BLUE "skipping:" MESSAGES IN ANSIBLE'S OUTPUT. + - name: Install/Enable/Disable/Record Sugarizer (main2.yml) IF 'mongodb_installed is defined' + include_tasks: main2.yml + when: mongodb_installed is defined -# - block: # ENTIRE BLOCK CONDITIONED ON 'when: mongodb_installed is defined' -# -# [MOVED TO main2.yml] -# -# when: mongodb_installed is defined # CONDITION FOR ENTIRE ABOVE block: + # THE block: APPROACH BELOW WORKS JUST LIKE main2.yml ABOVE. + # BUT IT VISUALLY POLLUTES: MANY BLUE "skipping:" MESSAGES IN ANSIBLE'S OUTPUT. + + # - block: # ENTIRE BLOCK CONDITIONED ON 'when: mongodb_installed is defined' + # + # [MOVED TO main2.yml] + # + # when: mongodb_installed is defined # CONDITION FOR ENTIRE ABOVE block: + + rescue: + + - name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})' + fail: + msg: "" + when: not skip_role_on_error diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 17b614453..22d000eac 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -16,6 +16,8 @@ iiab_base_ver: 8.0 iiab_revision: 0 +skip_role_on_error: False + iiab_etc_path: /etc/iiab # Main configuration file