Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion deployment/environments/hosts-ui.example
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ hosts_vitamui_mongod
# - mongo_rs_bootstrap=true (default: false); mandatory for 1 node of the shard, some init commands will be executed on it
# - mongo_cluster_name=mongo-vitamui (default: mongo-vitamui)
# - mongo_shard_id=0 (default: 0)
# - mongo_arbiter=true ; the node will be only an arbiter, it will not store data ; do not add this parameter on a mongo_rs_bootstrap node, maximum 1 node per shard
# - mongod_memory=x (default: unset); this will force the wiredtiger cache size to x (unit is GB)
# - is_small=true (default: false); this will force the priority for this server to be lower when electing master ; hardware can be downgraded for this machine
# - mongo_express_enabled=true to deploy mongo_express (default: false)
Expand Down
1 change: 0 additions & 1 deletion deployment/environments/hosts.local
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ hosts_vitamui_mongod
# - mongo_rs_bootstrap=true (default: false); mandatory for 1 node of the shard, some init commands will be executed on it
# - mongo_cluster_name=mongo-vitamui (default: mongo-vitamui)
# - mongo_shard_id=0 (default: 0)
# - mongo_arbiter=true ; the node will be only an arbiter, it will not store data ; do not add this parameter on a mongo_rs_bootstrap node, maximum 1 node per shard
# - mongod_memory=x (default: unset); this will force the wiredtiger cache size to x (unit is GB)
# - is_small=true (default: false); this will force the priority for this server to be lower when electing master ; hardware can be downgraded for this machine
# - mongo_express_enabled=true to deploy mongo_express (default: false)
Expand Down
15 changes: 15 additions & 0 deletions deployment/roles/checks/tasks/check_mongo_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

- name: Ensure no mongo_arbiter is present in production environments
fail:
msg: "ERROR: mongo_arbiter is enabled for server {{ inventory_hostname }} and it's not recommended on Production environments. Please follow the exploitation documentation to remove arbiter from your cluster."
when:
- mongo_arbiter | default(false) | bool
- deployment_mode | default('prod') == 'prod'

- name: Check if mongo_rs_bootstrap is not set as mongo_arbiter
fail:
msg: "ERROR: mongo_rs_bootstrap node can't be mongo_arbiter !"
when:
- mongo_arbiter | default(false) | bool
- mongo_rs_bootstrap | default(false) | bool
21 changes: 12 additions & 9 deletions deployment/roles/checks/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

- block:

- name: Check deployment_mode
assert:
fail_msg: "ERROR: Invalid deployment_mode. Expected values are 'prod' (default) or 'dev'"
success_msg: "{{ 'dev mode enabled, ignoring the following errors...' if deployment_mode | default('prod') == 'dev' else 'production mode enabled, execution will fail if errors are detected...' }}"
that: deployment_mode | default('prod') in ['prod', 'dev']
- name: Check deployment_mode
assert:
fail_msg: "ERROR: Invalid deployment_mode. Expected values are 'prod' (default) or 'dev'"
success_msg: "{{ 'dev mode enabled, ignoring the following errors...' if deployment_mode | default('prod') == 'dev' else 'production mode enabled, execution will fail if errors are detected...' }}"
that: deployment_mode | default('prod') in ['prod', 'dev']

- import_tasks: check_inventory.yml
- import_tasks: check_inventory.yml

- import_tasks: check_consul.yml
- import_tasks: check_consul.yml

- import_tasks: check_passwords.yml
- import_tasks: check_passwords.yml

- import_tasks: check_mongo_express.yml
- import_tasks: check_mongo_express.yml

run_once: true

- import_tasks: check_mongo_config.yml
when: inventory_hostname in groups['hosts_vitamui_mongod']
Loading