Subir archivos a 'playbooks'

This commit is contained in:
David Lopez 2023-07-20 18:40:16 +00:00
parent af20e9e463
commit c53a233667
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
---
# The playbook creates a new database test and populates data in the database to test the sharding.
- hosts: $servername
remote_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