community.mongodb.mongodb_balancer (1.6.1) — module

Manages the MongoDB Sharded Cluster Balancer.

| "added in version" 1.0.0 of community.mongodb"

Authors: Rhys Campbell (@rhysmeister)

Install collection

Install with ansible-galaxy collection install community.mongodb:==1.6.1


Add to requirements.yml

  collections:
    - name: community.mongodb
      version: 1.6.1

Description

Manages the MongoDB Sharded Cluster Balancer.

Start or stop the balancer.

Adjust the cluster chunksize.

Enable or disable autosplit.

Add or remove a balancer window.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Start the balancer
  community.mongodb.mongodb_balancer:
    state: started
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop the balancer and disable autosplit
  community.mongodb.mongodb_balancer:
    state: stopped
    autosplit: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable autosplit
  community.mongodb.mongodb_balancer:
    autosplit: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Change the default chunksize to 128MB
  community.mongodb.mongodb_balancer:
    chunksize: 128
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add or update a balancing window
  community.mongodb.mongodb_balancer:
    window:
      start: "23:00"
      stop: "06:00"
      state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a balancing window
  community.mongodb.mongodb_balancer:
    window:
      state: "absent"

Inputs

    
ssl:
    aliases:
    - tls
    default: false
    description:
    - Whether to use an SSL connection when connecting to the database.
    required: false
    type: bool

state:
    choices:
    - started
    - stopped
    default: started
    description:
    - Manage the Balancer for the Cluster
    required: false
    type: str

window:
    description:
    - Schedule the balancer window.
    - Provide the following dictionary keys start, stop, state
    - The state key should be "present" or "absent".
    - The start and stop keys are ignored when state is "absent".
    - start and stop should be strings in "HH:MM" format indicating the time bounds of
      the window.
    required: false
    type: raw

autosplit:
    description:
    - Disable or enable the autosplit flag in the config.settings collection.
    required: false
    type: bool

chunksize:
    description:
    - Control the size of chunks in the sharded cluster.
    - Value should be given in MB.
    required: false
    type: int

atlas_auth:
    default: false
    description:
    - Authentication path intended for MongoDB Atlas Instances
    type: bool

login_host:
    default: localhost
    description:
    - The host running MongoDB instance to login to.
    required: false
    type: str

login_port:
    default: 27017
    description:
    - The MongoDB server port to login to.
    required: false
    type: int

login_user:
    description:
    - The MongoDB user to login with.
    - Required when I(login_password) is specified.
    required: false
    type: str

ssl_crlfile:
    description:
    - The ssl_crlfile option takes a path to a CRL file.
    required: false
    type: str

ssl_keyfile:
    description:
    - Private key for the client certificate.
    required: false
    type: str

ssl_ca_certs:
    aliases:
    - tlsCAFile
    description:
    - The ssl_ca_certs option takes a path to a CA file.
    required: false
    type: str

ssl_certfile:
    aliases:
    - tlsCertificateKeyFile
    description:
    - Present a client certificate using the ssl_certfile option.
    required: false
    type: str

ssl_cert_reqs:
    aliases:
    - tlsAllowInvalidCertificates
    choices:
    - CERT_NONE
    - CERT_OPTIONAL
    - CERT_REQUIRED
    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
    type: str

auth_mechanism:
    choices:
    - SCRAM-SHA-256
    - SCRAM-SHA-1
    - MONGODB-X509
    - GSSAPI
    - PLAIN
    description:
    - Authentication type.
    required: false
    type: str

login_database:
    default: admin
    description:
    - The database where login credentials are stored.
    required: false
    type: str

login_password:
    description:
    - The password used to authenticate with.
    - Required when I(login_user) is specified.
    required: false
    type: str

mongos_process:
    default: mongos
    description:
    - Provide a custom name for the mongos process.
    - Most users can ignore this setting.
    required: false
    type: str

connection_options:
    description:
    - Additional connection options.
    - Supply as a list of dicts or strings containing key value pairs seperated with '='.
    elements: raw
    required: false
    type: list

ssl_pem_passphrase:
    aliases:
    - tlsCertificateKeyFilePassword
    description:
    - Passphrase to decrypt encrypted private keys.
    required: false
    type: str

strict_compatibility:
    default: true
    description:
    - Enforce strict requirements for pymongo and MongoDB software versions
    type: bool

Outputs

changed:
  description: Whether the balancer state or autosplit changed.
  returned: success
  type: bool
failed:
  description: If something went wrong
  returned: failed
  type: bool
msg:
  description: A short description of what happened.
  returned: failure
  type: str
new_autosplit:
  description: The new state of autosplit.
  returned: When autosplit is changed.
  type: str
new_balancer_state:
  description: The new state of the balancer.
  returned: When balancer state is changed
  type: str
new_chunksize:
  description: The new value for chunksize.
  returned: When chunksize is changed.
  type: int
old_autosplit:
  description: The previous state of autosplit.
  returned: When autosplit is changed.
  type: str
old_balancer_state:
  description: The previous state of the balancer
  returned: When balancer state is changed
  type: str
old_chunksize:
  description: The previous value for chunksize.
  returned: When chunksize is changed.
  type: int