ansible / ansible.builtin / v2.9.4 / module / mongodb_shard Add and remove shards from a MongoDB Cluster. | "added in version" 2.8 of ansible.builtin" Authors: Rhys Campbell (@rhysmeister) preview | supported by communityansible.builtin.mongodb_shard (v2.9.4) — module
pip
Install with pip install ansible==2.9.4
Add and remove shards from a MongoDB Cluster.
# 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
ssl: default: false description: - Whether to use an SSL connection when connecting to the database. type: bool shard: default: null description: - The shard connection string. - Should be supplied in the form <replicaset>/host:port as detailed in U(https://docs.mongodb.com/manual/tutorial/add-shards-to-shard-cluster/). - For example rs0/example1.mongodb.com:27017. required: true state: choices: - present - absent default: present description: - Whether the shard should be present or absent from the Cluster. required: false login_host: default: localhost description: - The host to login to. - This must be a mongos. required: false login_port: default: 27017 description: - The port to login to. required: false login_user: description: - The user to login with. required: false ssl_cert_reqs: choices: - CERT_REQUIRED - CERT_OPTIONAL - CERT_NONE default: CERT_REQUIRED description: - Specifies whether a certificate is required from the other side of the connection, and whether it will be validated if provided. required: false login_database: default: admin description: - The database where login credentials are stored. required: false login_password: description: - The password used to authenticate with. required: false
mongodb_shard: description: The name of the shard to create. returned: success type: str