For the complete documentation index, see llms.txt. This page is also available as Markdown.

MariaDB Cluster (v2)

mariadb_cluster_v2

This module supports creating, updating, restoring or destroying MariaDB Clusters using the DBaaS MariaDB v2 API. The cluster region is selected through the I(location) option; I(api_url) overrides the base API URL globally (for a proxy/test endpoint, not for region selection).

Example Syntax


name: Create Cluster
ionoscloudsdk.ionoscloud.mariadb_cluster_v2:
  location: 'de/fra'
  mariadb_version: '11.4'
  instances: 1
  cores: 1
  ram: 4
  storage_size: 10
  connection:
    datacenter: 'AnsibleAutoTestDBaaSMariaDB - DBaaS v2'
    lan: test_lan1
    primary_instance_address: 192.168.2.101/24
  name: 'ansible-test-v2'
  description: Ansible test MariaDB v2 cluster
  maintenance_window:
    day_of_the_week: Sunday
    time: 09:00:00
  backup_location: 'eu-central-3'
  backup_retention_days: 7
  db_username: 'dbadmin'
  db_password: ''
  db_database: 'my_database'
  wait: true
  wait_timeout: '3600'
register: cluster_response


name: Update Cluster
ionoscloudsdk.ionoscloud.mariadb_cluster_v2:
  location: 'de/fra'
  mariadb_cluster: ''
  cores: 2
  ram: 6
  storage_size: 20
  backup_retention_days: 14
  description: Updated Ansible test MariaDB v2 cluster
  db_username: 'dbadmin'
  db_password: ''
  db_database: 'my_database'
  state: update
  wait: true
  wait_timeout: '3600'
register: updated_cluster_response


name: Restore Cluster (in-place)
ionoscloudsdk.ionoscloud.mariadb_cluster_v2:
  location: 'de/fra'
  mariadb_cluster: ''
  recovery_target_time: ''
  db_username: 'dbadmin'
  db_password: ''
  db_database: 'my_database'
  state: restore
  wait: true
  wait_timeout: '3600'
register: restored_cluster_response


name: Delete Cluster (async)
ionoscloudsdk.ionoscloud.mariadb_cluster_v2:
  location: 'de/fra'
  mariadb_cluster: ''
  state: absent
  wait: false

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:

  • connection

  • backup_location

state: present

Available parameters for state present:

Name
Required
Description

maintenance_window dict

True

A weekly 4 hour-long window, during which maintenance might occur. A dict with keys `time` (start of the maintenance window in UTC, e.g. "16:30:00") and `day_of_the_week` (e.g. "Sunday").

mariadb_version str

True

The MariaDB version of the cluster. Use the mariadb_version_v2_info module (GET /versions) to retrieve the list of supported versions. To upgrade, provide a version listed in `can_upgrade_to` for the current version; downgrades are not supported.

instances int

True

The total number of instances in the cluster. A value of 1 creates a single-instance cluster; values 2 to 5 create a replicated cluster with one primary and n-1 secondary instances.

cores int

True

The number of CPU cores per instance. Accepted values are 1 to 62. On update, cores can be increased or decreased.

ram int

True

The amount of memory per instance in gigabytes (GB). Accepted values are 4 to 240. On update, RAM can be increased or decreased.

storage_size int

True

The amount of storage per instance in gigabytes (GB). Accepted values are 10 to 4096. On update, storage size can only be increased; it cannot be reduced.

connection dict

True

Connection information of the MariaDB cluster. A dict with keys `datacenter` (ID or name), `lan` (ID or name) and `primary_instance_address` (IP and netmask of the cluster's primary instance in CIDR notation, e.g. 192.168.2.101/24).

name str

True

The name of your MariaDB cluster. Must be 63 characters or less and must begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.

description str

False

A human-readable description for the cluster.

db_username str

True

The username of the initial MariaDB user. Must be 16 characters or less and must include only alphanumeric characters (`[A-Za-z0-9_]`) and underscores (`_`). Some usernames are reserved for platform use (for example `mariadb`, `admin`, `standby`). The credentials block is re-sent in full on every update and restore, so this option is also required for those states.

db_password str

True

The password for the initial MariaDB user. Must be between 10 and 256 characters long. For a strong password we recommend that it also meets the following criteria, though these are not enforced: - Contains at least one lowercase letter. - Contains at least one uppercase letter. - Contains at least one digit (0-9). - Contains at least one special character from the set: @$!%*?& The password is never returned by the API, so it must be supplied again on update and restore, and a change to it alone cannot be detected: a task whose only difference is a new db_password reports changed=false and sends no request.

db_database str

True

The name of the initial database to create and grant the user access to. Must be 63 characters or less and must include only alphanumeric characters (`[a-z0-9A-Z]`) and underscores (`_`).

backup_location str

True

The Object Storage location where the backups are created. The mariadb_backup_location_v2_info module provides a list of supported locations. Changing this forces the cluster to be re-created.

backup_retention_days int

True

The number of days cluster backups are retained. Accepted values are 1 to 365. If you reduce this value, backups older than the new retention window are purged.

logs_enabled bool

False

Activates or deactivates the collection and reporting of logs for this cluster's observability. If the observability service is not activated on the contract, this setting is accepted but has no effect. Log collection does not start until the observability service is active.

metrics_enabled bool

False

Activates or deactivates the collection and reporting of metrics for this cluster's observability. If the observability service is not activated on the contract, this setting is accepted but has no effect. Metric collection does not start until the observability service is active.

backup_id str

False

The ID of the backup to initialize the cluster from when creating (restore from an existing backup).

recovery_target_time str

False

Recovery target time (ISO 8601). Used to replay backups up to the specified time on creation (together with backup_id), or for an in-place restore when state is `restore`.

location str

False

The location (region) in which the cluster will be created. Different service endpoints are used based on location, possible options are: "de/fra", "de/txl", "es/vit", "fr/par", "gb/lhr", "gb/bhx", "us/ewr", "us/las", "us/mci". If not set, the endpoint will be the one corresponding to "de/txl". The api_url, if set, overrides this.

allow_replace bool

False

Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead Default: False

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

Available parameters for state absent:

Name
Required
Description

mariadb_cluster str

True

The ID or name of an existing MariaDB Cluster.

location str

False

The location (region) in which the cluster will be created. Different service endpoints are used based on location, possible options are: "de/fra", "de/txl", "es/vit", "fr/par", "gb/lhr", "gb/bhx", "us/ewr", "us/las", "us/mci". If not set, the endpoint will be the one corresponding to "de/txl". The api_url, if set, overrides this.

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

Available parameters for state update:

Name
Required
Description

maintenance_window dict

False

A weekly 4 hour-long window, during which maintenance might occur. A dict with keys `time` (start of the maintenance window in UTC, e.g. "16:30:00") and `day_of_the_week` (e.g. "Sunday").

mariadb_version str

False

The MariaDB version of the cluster. Use the mariadb_version_v2_info module (GET /versions) to retrieve the list of supported versions. To upgrade, provide a version listed in `can_upgrade_to` for the current version; downgrades are not supported.

instances int

False

The total number of instances in the cluster. A value of 1 creates a single-instance cluster; values 2 to 5 create a replicated cluster with one primary and n-1 secondary instances.

cores int

False

The number of CPU cores per instance. Accepted values are 1 to 62. On update, cores can be increased or decreased.

ram int

False

The amount of memory per instance in gigabytes (GB). Accepted values are 4 to 240. On update, RAM can be increased or decreased.

storage_size int

False

The amount of storage per instance in gigabytes (GB). Accepted values are 10 to 4096. On update, storage size can only be increased; it cannot be reduced.

name str

False

The name of your MariaDB cluster. Must be 63 characters or less and must begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.

description str

False

A human-readable description for the cluster.

db_username str

True

The username of the initial MariaDB user. Must be 16 characters or less and must include only alphanumeric characters (`[A-Za-z0-9_]`) and underscores (`_`). Some usernames are reserved for platform use (for example `mariadb`, `admin`, `standby`). The credentials block is re-sent in full on every update and restore, so this option is also required for those states.

db_password str

True

The password for the initial MariaDB user. Must be between 10 and 256 characters long. For a strong password we recommend that it also meets the following criteria, though these are not enforced: - Contains at least one lowercase letter. - Contains at least one uppercase letter. - Contains at least one digit (0-9). - Contains at least one special character from the set: @$!%*?& The password is never returned by the API, so it must be supplied again on update and restore, and a change to it alone cannot be detected: a task whose only difference is a new db_password reports changed=false and sends no request.

db_database str

True

The name of the initial database to create and grant the user access to. Must be 63 characters or less and must include only alphanumeric characters (`[a-z0-9A-Z]`) and underscores (`_`).

backup_retention_days int

False

The number of days cluster backups are retained. Accepted values are 1 to 365. If you reduce this value, backups older than the new retention window are purged.

logs_enabled bool

False

Activates or deactivates the collection and reporting of logs for this cluster's observability. If the observability service is not activated on the contract, this setting is accepted but has no effect. Log collection does not start until the observability service is active.

metrics_enabled bool

False

Activates or deactivates the collection and reporting of metrics for this cluster's observability. If the observability service is not activated on the contract, this setting is accepted but has no effect. Metric collection does not start until the observability service is active.

mariadb_cluster str

True

The ID or name of an existing MariaDB Cluster.

location str

False

The location (region) in which the cluster will be created. Different service endpoints are used based on location, possible options are: "de/fra", "de/txl", "es/vit", "fr/par", "gb/lhr", "gb/bhx", "us/ewr", "us/las", "us/mci". If not set, the endpoint will be the one corresponding to "de/txl". The api_url, if set, overrides this.

allow_replace bool

False

Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead Default: False

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

Available parameters for state restore:

Name
Required
Description

db_username str

True

The username of the initial MariaDB user. Must be 16 characters or less and must include only alphanumeric characters (`[A-Za-z0-9_]`) and underscores (`_`). Some usernames are reserved for platform use (for example `mariadb`, `admin`, `standby`). The credentials block is re-sent in full on every update and restore, so this option is also required for those states.

db_password str

True

The password for the initial MariaDB user. Must be between 10 and 256 characters long. For a strong password we recommend that it also meets the following criteria, though these are not enforced: - Contains at least one lowercase letter. - Contains at least one uppercase letter. - Contains at least one digit (0-9). - Contains at least one special character from the set: @$!%*?& The password is never returned by the API, so it must be supplied again on update and restore, and a change to it alone cannot be detected: a task whose only difference is a new db_password reports changed=false and sends no request.

db_database str

True

The name of the initial database to create and grant the user access to. Must be 63 characters or less and must include only alphanumeric characters (`[a-z0-9A-Z]`) and underscores (`_`).

recovery_target_time str

True

Recovery target time (ISO 8601). Used to replay backups up to the specified time on creation (together with backup_id), or for an in-place restore when state is `restore`.

mariadb_cluster str

True

The ID or name of an existing MariaDB Cluster.

location str

False

The location (region) in which the cluster will be created. Different service endpoints are used based on location, possible options are: "de/fra", "de/txl", "es/vit", "fr/par", "gb/lhr", "gb/bhx", "us/ewr", "us/las", "us/mci". If not set, the endpoint will be the one corresponding to "de/txl". The api_url, if set, overrides this.

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

Was this helpful?