Mongo Cluster
mongo_cluster
This is a module that supports creating and destroying Mongo Clusters
Example Syntax
name: Create Cluster
ionoscloudsdk.ionoscloud.mongo_cluster:
mongo_db_version: 5.0
instances: 3
location: de/fra
template_id: 6b78ea06-ee0e-4689-998c-fc9c46e781f6
connections:
- cidr_list:
- 192.168.1.116/24
- 192.168.1.117/24
- 192.168.1.118/24
datacenter: 'AnsibleAutoTestDBaaSMongo - DBaaS Mongo'
lan: test_lan
display_name: 'AnsibleTestMongoDBCluster'
wait: true
wait_timeout: 7200
register: cluster_response
name: Update Cluster
ionoscloudsdk.ionoscloud.mongo_cluster:
mongo_cluster: 'AnsibleTestMongoDBCluster'
display_name: 'AnsibleTestMongoDBCluster UPDATED'
state: update
allow_replace: false
wait: true
register: cluster_response
- name: Restore Mongo Cluster
mongo_cluster:
mongo_cluster: backuptest-05
backup_id: 9ab6545c-b138-4a86-b6ca-0d872a2b0953
state: restore
name: Delete Cluster
ionoscloudsdk.ionoscloud.mongo_cluster:
mongo_cluster: ''
state: absent
wait: false
Returned object
{
"changed": true,
"failed": false,
"action": "create",
"mongo_cluster": {
"type": "cluster",
"id": "3fdd2940-f9b4-425d-b52b-4199a84188d2",
"metadata": {
"created_date": "2023-05-30T13:43:20+00:00",
"created_by": "<USER_EMAIL>",
"created_by_user_id": "<USER_ID>",
"last_modified_date": null,
"last_modified_by": null,
"last_modified_by_user_id": null,
"state": "BUSY",
"health": "UNKNOWN"
},
"properties": {
"display_name": "AnsibleTestMongoDBCluster",
"mongo_db_version": "5.0",
"location": "de/fra",
"instances": 3,
"connections": [
{
"datacenter_id": "6b36f398-2089-414b-a57f-85f7b88aee5b",
"lan_id": "1",
"cidr_list": [
"<CIDR1>",
"<CIDR2>",
"<CIDR3>"
]
}
],
"maintenance_window": {
"time": "14:13:28",
"day_of_the_week": "Thursday"
},
"template_id": "6b78ea06-ee0e-4689-998c-fc9c46e781f6",
"connection_string": "<CONNECTION_STRING>"
}
}
}
For more examples please check out the tests here.
NOTE: If you are using a versions 7.0.0 and up: modules can replace resources if certain set parameters differ from the results found in the API!
Parameters that can trigger a resource replacement:
location
mongo_db_version
state: present
name: Create Cluster
ionoscloudsdk.ionoscloud.mongo_cluster:
mongo_db_version: 5.0
instances: 3
location: de/fra
template_id: 6b78ea06-ee0e-4689-998c-fc9c46e781f6
connections:
- cidr_list:
- 192.168.1.116/24
- 192.168.1.117/24
- 192.168.1.118/24
datacenter: 'AnsibleAutoTestDBaaSMongo - DBaaS Mongo'
lan: test_lan
display_name: 'AnsibleTestMongoDBCluster'
wait: true
wait_timeout: 7200
register: cluster_response
Available parameters for state present:
maintenance_window dict
False
A weekly window of 4 hours during which maintenance work can be performed.
mongo_db_version str
True
The MongoDB version of your cluster.
instances int
True
The total number of instances in the cluster (one primary and n-1 secondaries).
connections list
True
Array of datacenters to connect to your cluster.
template_id str
True
The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint.
location str
True
The physical location where the cluster will be created. This is the location where all your instances will be located. This property is immutable.
display_name str
True
The name of your cluster.
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', 'absent', 'update', 'restore']
state: absent
name: Delete Cluster
ionoscloudsdk.ionoscloud.mongo_cluster:
mongo_cluster: ''
state: absent
wait: false
Available parameters for state absent:
mongo_cluster str
True
The ID or name of an existing Mongo Cluster.
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', 'absent', 'update', 'restore']
state: update
name: Update Cluster
ionoscloudsdk.ionoscloud.mongo_cluster:
mongo_cluster: 'AnsibleTestMongoDBCluster'
display_name: 'AnsibleTestMongoDBCluster UPDATED'
state: update
allow_replace: false
wait: true
register: cluster_response
Available parameters for state update:
mongo_cluster str
True
The ID or name of an existing Mongo Cluster.
maintenance_window dict
False
A weekly window of 4 hours during which maintenance work can be performed.
mongo_db_version str
False
The MongoDB version of your cluster.
instances int
False
The total number of instances in the cluster (one primary and n-1 secondaries).
connections list
False
Array of datacenters to connect to your cluster.
template_id str
False
The unique ID of the template, which specifies the number of cores, storage size, and memory. You cannot downgrade to a smaller template or minor edition (e.g. from business to playground). To get a list of all templates to confirm the changes use the /templates endpoint.
location str
False
The physical location where the cluster will be created. This is the location where all your instances will be located. This property is immutable.
display_name str
False
The name of your cluster.
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', 'absent', 'update', 'restore']
state: restore
- name: Restore Mongo Cluster
mongo_cluster:
mongo_cluster: backuptest-05
backup_id: 9ab6545c-b138-4a86-b6ca-0d872a2b0953
state: restore
Available parameters for state restore:
mongo_cluster str
True
The ID or name of an existing Mongo Cluster.
backup_id str
True
The ID of the backup to be used.
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', 'absent', 'update', 'restore']
Last updated