diff --git a/roles/mongodb/tasks/main.yml b/roles/mongodb/tasks/main.yml index eb7623137..f106a103d 100644 --- a/roles/mongodb/tasks/main.yml +++ b/roles/mongodb/tasks/main.yml @@ -31,24 +31,30 @@ - debug: var: is_raspbian -#- name: EXIT 'mongodb' ROLE & CONTINUE, IF 'is_debian and not is_raspbian' i.e. TRUE DEBIAN (where MongoDB no longer exists) -# fail: # FORCE IT RED THIS ONCE! -# msg: ATTEMPTED MongoDB INSTALLATION WITH (TRUE) DEBIAN, which is no longer supported. Nevertheless IIAB will continue (consider this a warning!) -# when: is_debian_10 and (ansible_architecture == "aarch64") -# #when: (is_debian and not is_raspbian) and (not is_debian_8) and (not is_debian_9) # Test for Debian 10+ -# ignore_errors: yes +- 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 -# ELSE... +- name: Disable & Stop 'mongodb' service, if not mongodb_enabled + systemd: + name: mongodb + enabled: no + state: stopped + when: not mongodb_enabled -- name: Install/Enable/Disable/Record MongoDB (main2.yml) if is_raspbian or not is_debian, i.e. not True Debian - include_tasks: main2.yml -# when: is_raspbian or not is_debian +#'mongodb' systemd service - started on demand by sugarizer +# Just recording that mongodb should be running -# 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: is_raspbian or not is_debian' -# -# [MOVED TO main2.yml] -# -# when: is_raspbian or not is_debian # CONDITION FOR ENTIRE ABOVE block: +- 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: enabled + value: "{{ mongodb_enabled }}" diff --git a/roles/mongodb/tasks/main2.yml b/roles/mongodb/tasks/main2.yml deleted file mode 100644 index 49ec6175f..000000000 --- a/roles/mongodb/tasks/main2.yml +++ /dev/null @@ -1,27 +0,0 @@ -- 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 - -- name: Disable & Stop 'mongodb' service, if not mongodb_enabled - systemd: - name: mongodb - enabled: no - state: stopped - when: not mongodb_enabled - -#'mongodb' systemd service - started on demand by sugarizer -# Just recording that mongodb should be running - -- 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: enabled - value: "{{ mongodb_enabled }}"