community.mongodb.mongodb_info (1.6.1) — module

Gather information about MongoDB instance.

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

Authors: Andrew Klychkov (@Andersson007)

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

Gather information about MongoDB instance.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather all supported information
  community.mongodb.mongodb_info:
    login_user: admin
    login_password: secret
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Show gathered info
  debug:
    msg: '{{ result }}'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather only information about databases and their total size
  community.mongodb.mongodb_info:
    login_user: admin
    login_password: secret
    filter: databases, total_size
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Gather all information except parameters
  community.mongodb.mongodb_info:
    login_user: admin
    login_password: secret
    filter: '!parameters'

Inputs

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

filter:
    description:
    - Limit the collected information by comma separated string or YAML list.
    - Allowable values are C(general), C(databases), C(total_size), C(parameters), C(users),
      C(roles).
    - By default, collects all subsets.
    - You can use '!' before value (for example, C(!users)) to exclude it from the information.
    - If you pass including and excluding values to the filter, for example, I(filter=!general,users),
      the excluding values, C(!general) in this case, will be ignored.
    elements: str
    required: false
    type: list

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

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

databases:
  description: Database information.
  returned: always
  sample:
    admin:
      empty: false
      sizeOnDisk: 245760
    config:
      empty: false
      sizeOnDisk: 110592
  type: dict
general:
  description: General instance information.
  returned: always
  sample:
    allocator: tcmalloc
    bits: 64
    maxBsonObjectSize: 16777216
    storageEngines:
    - biggie
    version: 4.2.3
  type: dict
parameters:
  description: Server parameters information.
  returned: always
  sample:
    maxOplogTruncationPointsAfterStartup: 100
    maxOplogTruncationPointsDuringStartup: 100
    maxSessions: 1000000
  type: dict
roles:
  description: Role information.
  returned: always
  sample:
    db:
      restore:
        inheritedRoles: []
        isBuiltin: true
        roles: []
  type: dict
total_size:
  description: Total size of all databases in bytes.
  returned: always
  sample: 397312
  type: int
users:
  description: User information.
  returned: always
  sample:
    db:
      new_user:
        _id: config.new_user
        mechanisms:
        - SCRAM-SHA-1
        - SCRAM-SHA-256
        roles: []
  type: dict