mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-10 20:00:18 +01:00
17 lines
777 B
YAML
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
|