mongodb_shard – Add and remove shards from a MongoDB Cluster¶
New in version 2.8.
Parameters¶
Notes¶
Note
Requires the pymongo Python package on the remote host, version 2.4.2+.
This can be installed using pip or the OS package manager. @see http://api.mongodb.org/python/current/installation.html.
Examples¶
# add a replicaset shard named rs1 with a member running on port 27018 on mongodb0.example.net
- mongodb_shard:
login_user: admin
login_password: admin
shard: "rs1/mongodb0.example.net:27018"
state: present
# add a standalone mongod shard running on port 27018 of mongodb0.example.net
- mongodb_shard:
login_user: admin
login_password: admin
shard: "mongodb0.example.net:27018"
state: present
# To remove a shard called 'rs1'
- mongodb_shard:
login_user: admin
login_password: admin
shard: rs1
state: absent
# Single node shard running on localhost
- name: Ensure shard rs0 exists
mongodb_shard:
login_user: admin
login_password: secret
shard: "rs0/localhost:3001"
state: present
# Single node shard running on localhost
- name: Ensure shard rs1 exists
mongodb_shard:
login_user: admin
login_password: secret
shard: "rs1/localhost:3002"
state: present
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
mongodb_shard
string
|
success |
The name of the shard to create.
|
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Rhys Campbell (@rhysmeister)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.