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

Merge pull request #3255 from holta/skip_role_on_error

Prototype 'skip_role_on_error: True' in 4 roles {lokole, moodle, mongodb, sugarizer}
This commit is contained in:
A Holt 2022-06-18 11:48:00 -04:00 committed by GitHub
commit 83ea6ce852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 155 additions and 115 deletions

View file

@ -21,7 +21,7 @@
- name: MOODLE - name: MOODLE
include_role: include_role:
name: moodle 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 - name: OSM-VECTOR-MAPS
include_role: include_role:
@ -43,7 +43,7 @@
- name: SUGARIZER - name: SUGARIZER
include_role: include_role:
name: sugarizer 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 ======================== - name: Recording STAGE 7 HAS COMPLETED ========================
lineinfile: lineinfile:

View file

@ -19,53 +19,62 @@
quiet: yes quiet: yes
- name: Install Lokole if lokole_installed is not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - block:
include_tasks: install.yml
when: lokole_installed is undefined - 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' - name: Do a 'systemctl daemon-reload'
systemd: systemd:
daemon_reload: yes daemon_reload: yes
when: lokole_enabled when: lokole_enabled
- name: Enable & Restart supervisor systemd service, if lokole_enabled - name: Enable & Restart supervisor systemd service, if lokole_enabled
systemd: systemd:
name: supervisor name: supervisor
enabled: yes enabled: yes
state: restarted state: restarted
when: lokole_enabled when: lokole_enabled
- name: Disable & Stop supervisor systemd service, if not lokole_enabled - name: Disable & Stop supervisor systemd service, if not lokole_enabled
systemd: systemd:
name: supervisor name: supervisor
enabled: no enabled: no
state: stopped state: stopped
when: not lokole_enabled when: not lokole_enabled
- name: Enable/Disable/Restart NGINX - name: Enable/Disable/Restart NGINX
include_tasks: nginx.yml include_tasks: nginx.yml
- name: Add 'lokole' variable values to {{ iiab_ini_file }} - name: Add 'lokole' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: lokole section: lokole
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value | string }}" value: "{{ item.value | string }}"
with_items: with_items:
- option: name - option: name
value: Lokole value: Lokole
- option: description - 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. 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."' #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 - option: lokole_install
value: "{{ lokole_install }}" value: "{{ lokole_install }}"
- option: lokole_enabled - option: lokole_enabled
value: "{{ lokole_enabled }}" value: "{{ lokole_enabled }}"
- option: lokole_settings - option: lokole_settings
value: "{{ lokole_settings }}" value: "{{ lokole_settings }}"
- option: lokole_url - option: lokole_url
value: "{{ lokole_url }}" value: "{{ lokole_url }}"
- option: lokole_full_url - option: lokole_full_url
value: "{{ 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

View file

@ -44,29 +44,37 @@
# ELSE... # 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!) - name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: enable-or-disable.yml include_tasks: install.yml
when: mongodb_installed is defined 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 }} - name: Add 'mongodb' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: mongodb section: mongodb
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value | string }}" value: "{{ item.value | string }}"
with_items: with_items:
- option: name - option: name
value: MongoDB value: MongoDB
- option: description - option: description
value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."' value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."'
- option: mongodb_install - option: mongodb_install
value: "{{ mongodb_install }}" value: "{{ mongodb_install }}"
- option: mongodb_enabled - option: mongodb_enabled
value: "{{ 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

View file

@ -19,28 +19,35 @@
quiet: yes quiet: yes
- name: Install Moodle if 'moodle_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - block:
include_tasks: install.yml
when: moodle_installed is undefined
- 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 }} rescue:
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini - name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})'
section: moodle fail:
option: "{{ item.option }}" msg: ""
value: "{{ item.value | string }}" when: not skip_role_on_error
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 }}"

View file

@ -19,39 +19,53 @@
quiet: yes quiet: yes
# 3 stanzas moved up from install.yml, so Debian-or-any-OS-where-MongoDB-fails - block:
# still finish their "LARGE-sized" IIAB install: (WITH LOUD RED WARNINGS!)
- name: "Set 'mongodb_install: True'" # 3 stanzas moved up from install.yml, so Debian-or-any-OS-where-MongoDB-fails
set_fact: # still finish their "LARGE-sized" IIAB install: (WITH LOUD RED WARNINGS!)
mongodb_install: True
- name: 'CAUTION: IF ''mongodb.service'' IS STOPPED FOR ANY REASON, IT WILL IMMEDIATELY CAUSE SUGARIZER TO FAIL ("502 Bad Gateway") !' - name: "Set 'mongodb_install: True'"
debug: set_fact:
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)." mongodb_install: True
- name: MONGODB - run 'mongodb' role (attempt to install MongoDB) - name: 'CAUTION: IF ''mongodb.service'' IS STOPPED FOR ANY REASON, IT WILL IMMEDIATELY CAUSE SUGARIZER TO FAIL ("502 Bad Gateway") !'
include_role: debug:
name: mongodb 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' # - name: EXIT 'sugarizer' ROLE & CONTINUE, IF 'mongodb_installed is undefined'
fail: # FORCE IT RED THIS ONCE! # 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!) # 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 # when: mongodb_installed is undefined
ignore_errors: yes # 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' # ELSE...
include_tasks: main2.yml
when: mongodb_installed is defined
# THE block: APPROACH BELOW WORKS JUST LIKE main2.yml ABOVE. - name: Install/Enable/Disable/Record Sugarizer (main2.yml) IF 'mongodb_installed is defined'
# BUT IT VISUALLY POLLUTES: MANY BLUE "skipping:" MESSAGES IN ANSIBLE'S OUTPUT. include_tasks: main2.yml
when: mongodb_installed is defined
# - block: # ENTIRE BLOCK CONDITIONED ON 'when: mongodb_installed is defined' # THE block: APPROACH BELOW WORKS JUST LIKE main2.yml ABOVE.
# # BUT IT VISUALLY POLLUTES: MANY BLUE "skipping:" MESSAGES IN ANSIBLE'S OUTPUT.
# [MOVED TO main2.yml]
# # - block: # ENTIRE BLOCK CONDITIONED ON 'when: mongodb_installed is defined'
# when: mongodb_installed is defined # CONDITION FOR ENTIRE ABOVE block: #
# [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

View file

@ -16,6 +16,8 @@
iiab_base_ver: 8.0 iiab_base_ver: 8.0
iiab_revision: 0 iiab_revision: 0
skip_role_on_error: False
iiab_etc_path: /etc/iiab iiab_etc_path: /etc/iiab
# Main configuration file # Main configuration file