mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Cleaner Dependencies e.g. for Sugarizer, Moodle, Node-Red, PBX, Elgg
This commit is contained in:
parent
106558aca9
commit
027832889b
88 changed files with 1212 additions and 909 deletions
|
@ -135,6 +135,6 @@
|
|||
|
||||
- name: "Add 'mongodb_installed: True' to {{ iiab_state_file }}"
|
||||
lineinfile:
|
||||
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
||||
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
||||
regexp: '^mongodb_installed'
|
||||
line: 'mongodb_installed: True'
|
||||
|
|
|
@ -18,42 +18,37 @@
|
|||
fail_msg: "PLEASE GIVE VARIABLE 'mongodb_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml"
|
||||
quiet: yes
|
||||
|
||||
- name: EXIT MONGODB PLAYBOOK, IF DEBIAN 10+ (where MongoDB doesn't exist)
|
||||
meta: end_play
|
||||
when: (is_debian and not is_raspbian) and (not is_debian_8) and (not is_debian_9)
|
||||
- debug:
|
||||
var: mongodb_install
|
||||
- debug:
|
||||
var: mongodb_enabled
|
||||
- debug:
|
||||
var: mongodb_installed
|
||||
|
||||
|
||||
- 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
|
||||
- debug:
|
||||
var: is_debian
|
||||
- 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 and not is_raspbian
|
||||
#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: Enable & Restart 'mongodb' systemd service if mongodb_enabled, incl daemon-reload (in case mongodb.service changed?)
|
||||
systemd:
|
||||
name: mongodb
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: mongodb_enabled | bool
|
||||
# ELSE...
|
||||
|
||||
- name: Disable '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
|
||||
|
||||
# THE block: APPROACH BELOW WORKS JUST LIKE main2.yml ABOVE.
|
||||
# BUT IT VISUALLY POLLUTES: MANY BLUE "skipping:" MESSAGES IN ANSIBLE'S OUTPUT.
|
||||
|
||||
- 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 }}"
|
||||
# - 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:
|
||||
|
|
34
roles/mongodb/tasks/main2.yml
Normal file
34
roles/mongodb/tasks/main2.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
- 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: Enable & Restart 'mongodb' systemd service if mongodb_enabled, incl daemon-reload (in case mongodb.service changed?)
|
||||
systemd:
|
||||
name: mongodb
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: mongodb_enabled | bool
|
||||
|
||||
- name: Disable & Stop 'mongodb' service, if not mongodb_enabled
|
||||
systemd:
|
||||
name: mongodb
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: not 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: enabled
|
||||
value: "{{ mongodb_enabled }}"
|
Loading…
Add table
Add a link
Reference in a new issue