configure prod MongoDB replicate set
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
20a59a1e2c
commit
efe0c3269b
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: Configure MongoDB
|
- name: Configure MongoDB dev cluster
|
||||||
hosts: mongodb
|
hosts: db.dev
|
||||||
roles:
|
roles:
|
||||||
- mongodb-firewall
|
- mongodb-firewall
|
||||||
- mongodb-setup
|
- mongodb-setup
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
# versions
|
# versions
|
||||||
mongodb_version: "4.0"
|
mongodb_version: "4.0"
|
||||||
|
# Fixes: https://github.com/ansible/ansible/issues/44970
|
||||||
mongodb_pymongo_pip_version: 3.8.0
|
mongodb_pymongo_pip_version: 3.8.0
|
||||||
|
|
||||||
# listening address & port
|
# listening address & port
|
||||||
|
@ -33,11 +34,15 @@ mongodb_oplog_users:
|
||||||
mongodb_login_host_vars: '{{ hostvars[groups["db.prod"][0]] }}'
|
mongodb_login_host_vars: '{{ hostvars[groups["db.prod"][0]] }}'
|
||||||
mongodb_login_host: '{{ mongodb_login_host_vars["dns_entry"] }}'
|
mongodb_login_host: '{{ mongodb_login_host_vars["dns_entry"] }}'
|
||||||
|
|
||||||
# TODO generate this dynamically
|
|
||||||
mongodb_replication_params:
|
mongodb_replication_params:
|
||||||
|
- host_name: '{{ hostvars[groups["db.prod"][0]].dns_entry }}'
|
||||||
- host_name: '{{ hostvars[groups["db.prod"][1]].dns_entry }}'
|
- host_name: '{{ hostvars[groups["db.prod"][1]].dns_entry }}'
|
||||||
- host_name: '{{ hostvars[groups["db.prod"][2]].dns_entry }}'
|
- host_name: '{{ hostvars[groups["db.prod"][2]].dns_entry }}'
|
||||||
|
|
||||||
|
# avoid having to auth on localhost
|
||||||
|
mongodb_set_parameters:
|
||||||
|
enableLocalhostAuthBypass: "true"
|
||||||
|
|
||||||
# backups auth
|
# backups auth
|
||||||
mongodb_backup_db_name: '{{ mongodb_users[0].database }}'
|
mongodb_backup_db_name: '{{ mongodb_users[0].database }}'
|
||||||
mongodb_backup_db_user: '{{ mongodb_users[0].name }}'
|
mongodb_backup_db_user: '{{ mongodb_users[0].name }}'
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
# use this variable for replica set init only
|
||||||
|
# or when master is moved from initial master node
|
||||||
|
mongodb_master: true
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
- name: Configure MongoDB prod cluster
|
||||||
|
hosts: db.prod
|
||||||
|
roles:
|
||||||
|
- mongodb-firewall
|
||||||
|
- mongodb-setup
|
||||||
|
- mongodb-backups
|
||||||
|
post_tasks:
|
||||||
|
- name: MongoDB URI string
|
||||||
|
debug:
|
||||||
|
msg: 'mongodb://{{ mongodb_users[0].name }}:{{ mongodb_users[0].password }}@{{ dns_entry }}:{{ mongodb_net_port }}/{{ mongodb_users[0].database }}'
|
|
@ -19,6 +19,8 @@
|
||||||
src: git@github.com:status-im/infra-role-s3cmd-backup.git
|
src: git@github.com:status-im/infra-role-s3cmd-backup.git
|
||||||
scm: git
|
scm: git
|
||||||
|
|
||||||
|
# WARNING: Fails if python3 is the default
|
||||||
|
# Details:
|
||||||
- name: mongodb-setup
|
- name: mongodb-setup
|
||||||
src: https://github.com/UnderGreen/ansible-role-mongodb.git
|
src: https://github.com/UnderGreen/ansible-role-mongodb.git
|
||||||
scm: git
|
scm: git
|
||||||
|
|
Loading…
Reference in New Issue