1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 20:22:08 +00:00

mongodb - iiab_installed

This commit is contained in:
Jerry Vonau 2019-10-14 12:18:16 -05:00
parent 70e7c7c7b5
commit b1ad64974e
3 changed files with 50 additions and 39 deletions

View file

@ -0,0 +1,38 @@
# 3. ENABLE/DISABLE
# 2019-07-08: mongodb_install is completely ignored. FYI mongodb_enabled: False
# works but is ineffective, as Sugarizer starts mongodb's systemd svc on its own
- 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 'mongodb' service, if not mongodb_enabled
systemd:
name: mongodb
daemon_reload: yes
enabled: no
state: stopped
when: not mongodb_enabled
# 4. DOCUMENT IN /etc/iiab/iiab.ini
- name: Add 'mongodb' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: mongodb
option: "{{ item.option }}"
value: "{{ item.value }}"
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 }}"

View file

@ -128,41 +128,9 @@
- { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' }
- { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' }
# 3. ENABLE/DISABLE
# 2019-07-08: mongodb_install is completely ignored. FYI mongodb_enabled: False
# works but is ineffective, as Sugarizer starts mongodb's systemd svc on its own
- 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 'mongodb' service, if not mongodb_enabled
systemd:
name: mongodb
daemon_reload: yes
enabled: no
state: stopped
when: not mongodb_enabled
# 4. DOCUMENT IN /etc/iiab/iiab.ini
- name: Add 'mongodb' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: mongodb
option: "{{ item.option }}"
value: "{{ item.value }}"
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 }}"
- name: Add 'mongodb_installed' variable values to {{ iiab_installed }}
lineinfile:
dest: "{{ iiab_installed }}"
regexp: '^mongodb_installed'
line: 'mongodb_installed: True'
state: present

View file

@ -3,4 +3,9 @@
- name: Install 'mongodb' if not Debian 10+
include_tasks: install.yml
when: not ((is_debian and not is_raspbian) and (not is_debian_8) and (not is_debian_9))
when: not ((is_debian and not is_raspbian) and (not is_debian_8) and (not is_debian_9)) and not mongodb_installed is defined
- name: Enable 'mongodb' if not Debian 10+
include_tasks: enable.yml
when: not ((is_debian and not is_raspbian) and (not is_debian_8) and (not is_debian_9)) or mongodb_installed is defined