Mongo Cluster User

mongo_cluster_user

This is a module that supports creating and destroying Mongo Cluster Users

Example Syntax


name: Create Cluster User
ionoscloudsdk.ionoscloud.mongo_cluster_user:
  mongo_cluster: ''
  mongo_username: testuser
  mongo_password: '{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_letters,digits') }}'
  user_roles:
  - role: read
    database: test
register: mongo_user_response


name: Update User
ionoscloudsdk.ionoscloud.mongo_cluster_user:
  mongo_cluster: ''
  mongo_username: testuser
  mongo_password: '{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_letters,digits') }}'
  user_roles:
  - role: read
    database: test
  - role: readWrite
    database: test
  state: update
register: mongo_user_response


name: Delete Cluster User
ionoscloudsdk.ionoscloud.mongo_cluster_user:
  mongo_cluster: ''
  mongo_username: testuser
  state: absent
register: mongo_user_response

Returned object

{
    "changed": true,
    "failed": false,
    "action": "create",
    "mongo_cluster_user": {
        "type": "user",
        "metadata": {
            "created_date": "2023-05-30T14:20:09+00:00",
            "created_by": "<USER_EMAIL>",
            "created_by_user_id": "<USER_ID>"
        },
        "properties": {
            "username": "testuser",
            "password": null,
            "roles": [
                {
                    "role": "read",
                    "database": "test"
                }
            ]
        }
    }
}

For more examples please check out the tests here.

state: present

  
name: Create Cluster User
ionoscloudsdk.ionoscloud.mongo_cluster_user:
  mongo_cluster: ''
  mongo_username: testuser
  mongo_password: '{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_letters,digits') }}'
  user_roles:
  - role: read
    database: test
register: mongo_user_response

Available parameters for state present:

NameRequiredDescription

mongo_cluster str

True

The UUID or name of an existing Mongo Cluster.

mongo_username str

True

The username of the user.

mongo_password str

True

The password of the user.

user_roles list

True

A list of mongodb user roles. A user role is represented as a dict containing 2 keys:'role': has one of the following values: 'read', 'readWrite' or 'readAnyDatabase''database': the name of the databse to which the role applies

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'update', 'absent']

state: update

  
name: Update User
ionoscloudsdk.ionoscloud.mongo_cluster_user:
  mongo_cluster: ''
  mongo_username: testuser
  mongo_password: '{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_letters,digits') }}'
  user_roles:
  - role: read
    database: test
  - role: readWrite
    database: test
  state: update
register: mongo_user_response

Available parameters for state update:

NameRequiredDescription

mongo_cluster str

True

The UUID or name of an existing Mongo Cluster.

mongo_username str

True

The username of the user.

mongo_password str

False

The password of the user.

user_roles list

False

A list of mongodb user roles. A user role is represented as a dict containing 2 keys:'role': has one of the following values: 'read', 'readWrite' or 'readAnyDatabase''database': the name of the databse to which the role applies

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'update', 'absent']

state: absent

  
name: Delete Cluster User
ionoscloudsdk.ionoscloud.mongo_cluster_user:
  mongo_cluster: ''
  mongo_username: testuser
  state: absent
register: mongo_user_response

Available parameters for state absent:

NameRequiredDescription

mongo_cluster str

True

The UUID or name of an existing Mongo Cluster.

mongo_username str

True

The username of the user.

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'update', 'absent']

Last updated