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
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:

View file

@ -19,35 +19,37 @@
quiet: yes
- name: Install Lokole if lokole_installed is not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
- 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'
- name: Do a 'systemctl daemon-reload'
systemd:
daemon_reload: yes
when: lokole_enabled
- name: Enable & Restart supervisor systemd service, if 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
- 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
- name: Enable/Disable/Restart NGINX
include_tasks: nginx.yml
- name: Add 'lokole' variable values to {{ iiab_ini_file }}
- name: Add 'lokole' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: lokole
@ -69,3 +71,10 @@
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

View file

@ -44,18 +44,19 @@
# ELSE...
- name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
- block:
- 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!)
- 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:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: mongodb
@ -70,3 +71,10 @@
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

View file

@ -19,15 +19,15 @@
quiet: yes
- name: Install Moodle if 'moodle_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
- 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 }}
- name: Add 'moodle' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: moodle
@ -44,3 +44,10 @@
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

View file

@ -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'"
# 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: "Set 'mongodb_install: True'"
set_fact:
mongodb_install: True
- name: 'CAUTION: IF ''mongodb.service'' IS STOPPED FOR ANY REASON, IT WILL IMMEDIATELY CAUSE SUGARIZER TO FAIL ("502 Bad Gateway") !'
- 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)
- 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!)
# - 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
- 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
ignore_errors: yes
# ELSE...
# ELSE...
- name: Install/Enable/Disable/Record Sugarizer (main2.yml) IF 'mongodb_installed is defined'
- name: Install/Enable/Disable/Record Sugarizer (main2.yml) IF 'mongodb_installed is defined'
include_tasks: main2.yml
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.
# 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:
# - 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

View file

@ -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