ansible-role-apache/mongodb/playbooks/testsharding.yml
2013-04-20 10:14:40 +05:30

17 lines
777 B
YAML

---
# 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