You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ansible-role-nginx/mongodb/playbooks/testsharding.yml

17 lines
777 B

---
# The playbook creates a new database test and populates data in the database to test the sharding.
- hosts: $servername
user: root
tasks:
- name: Create a new database and user
mongodb_user: login_user=admin login_password=${mongo_admin_pass} login_port=${mongos_port} database=test user=admin password=${mongo_admin_pass} state=present
- name: Pause for the user to get created and replicated
pause: minutes=3
- name: Execute the collection creation script
command: /usr/bin/mongo localhost:${mongos_port}/test -u admin -p ${mongo_admin_pass} /tmp/testsharding.js
- name: Enable sharding on the database and collection
command: /usr/bin/mongo localhost:${mongos_port}/admin -u admin -p ${mongo_admin_pass} /tmp/enablesharding.js