Skip to content

srwiser/ansible-mongo-replica-set

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deployment of a mongodb replicaset with authN / authZ

This playbook setup a MongoDB replicaset with

  • user authentication / authorization
  • secure communication between the nodes (using key file).

Inventory

The inventory/ENVIRONMENT.ini file defines the hosts (primary and secondaries) used for the replicaset.
On top the host decalration, some databasqe parameters are defined

[primary]
PRIMARY_IP

[secondary]
SECONDARY_1_IP
SECONDARY_2_IP

[primary:vars]
db_user_admin_username=USER_ADMIN_USERNAME
db_user_admin_password=USER_ADMIN_PASSWORD
db_cluster_admin_username=CLUSTER_ADMIN_USERNAME
db_cluster_admin_password=CLUSTER_ADMIN_PASSWORD
db_user_name=DB_USERNAME
db_user_password=DB_PASSWORD
db_name=DB_NAME

Nodes initialisation

ansible-playbook -i inventory/ENVIRONMENT.ini -k -s init.yml

ansible-playbook -i inventory/ENVIRONMENT.ini main.yml --extra-vars '{"replSet":"replicasetname", "storage":"wiredtiger/mmapv1"}'

If you want to cleanup everything

ansible-playbook -i inventory/ENVIRONMENT.ini clean.yml

About

Deploy Replica Set with Ansible

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published