MariaDB Cluster

mariadb_cluster

This is a module that supports creating, updating or destroying MariaDB Clusters

Example Syntax

- name: Create MariaDB Cluster
    mariadb_cluster:
      mariadb_version: 12
      instances: 1
      cores: 1
      ram: 2048
      storage_size: 20480
      connections:
        - cidr: 192.168.1.106/24
          datacenter: DatacenterName
          lan: LanName
      display_name: backuptest-04
      db_username: test
      db_password: 7357cluster
      wait: true
    register: cluster_response
  
- name: Update MariaDB Cluster
    mariadb_cluster:
      mariadb_cluster: backuptest-04
      mariadb_version: 12
      instances: 2
      cores: 2
      ram: 4096
      storage_size: 30480
      state: update
      wait: true
    register: updated_cluster_response
  
- name: Delete MariaDB Cluster
    mariadb_cluster:
      mariadb_cluster: backuptest-04
      state: absent

Returned object

{
    "changed": false,
    "failed": false,
    "action": "create",
    "mariadb_cluster": {
        "id": "7182ab85-3671-45e5-b2bb-e943c4479e03",
        "metadata": {
            "created_date": "2024-02-27T16:02:55+00:00",
            "created_by": "<USER_EMAIL>",
            "created_by_user_id": "<USER_ID>",
            "last_modified_date": "2024-02-27T16:02:55+00:00",
            "last_modified_by": "<USER_EMAIL>",
            "last_modified_by_user_id": "<USER_ID>",
            "state": "AVAILABLE"
        },
        "properties": {
            "display_name": "MariaDB-cluster",
            "mariadb_version": "10.6",
            "dns_name": "<CLUSTER_DNS>",
            "instances": 1,
            "ram": 4,
            "cores": 4,
            "storage_size": 10,
            "connections": [
                {
                    "datacenter_id": "3e223566-5a98-495a-9e4c-2c5fc71c057b",
                    "lan_id": "2",
                    "cidr": "<CIDR"
                }
            ],
            "maintenance_window": {
                "time": "14:17:42",
                "day_of_the_week": "Tuesday"
            }
        }
    }
}

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:

  • mariadb_version

  • connections

  • maintenance_window

  • instances

  • cores

  • ram

  • storage_size

  • display_name

state: present

  - name: Create MariaDB Cluster
    mariadb_cluster:
      mariadb_version: 12
      instances: 1
      cores: 1
      ram: 2048
      storage_size: 20480
      connections:
        - cidr: 192.168.1.106/24
          datacenter: DatacenterName
          lan: LanName
      display_name: backuptest-04
      db_username: test
      db_password: 7357cluster
      wait: true
    register: cluster_response
  

Available parameters for state present:

NameRequiredDescription

maintenance_window dict

False

A weekly 4 hour-long window, during which maintenance might occur.

mariadb_version str

True

The MariaDB version of your cluster.

instances int

True

The total number of instances in the cluster (one master and n-1 standbys).

cores int

True

The number of CPU cores per instance.

ram int

True

The amount of memory per instance in megabytes. Has to be a multiple of 1024.

storage_size int

True

The amount of storage per instance in megabytes.

connections list

True

Array of datacenters to connect to your cluster.

display_name str

True

The friendly name of your cluster.

db_username str

True

The username for the initial MariaDB user. Some system usernames are restricted (e.g. "mariadb", "admin", "standby").

db_password str

True

The password for a MariaDB user.

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

  - name: Delete MariaDB Cluster
    mariadb_cluster:
      mariadb_cluster: backuptest-04
      state: absent
  

Available parameters for state absent:

NameRequiredDescription

mariadb_cluster str

True

The ID or name of an existing MariaDB 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 MariaDB Cluster
    mariadb_cluster:
      mariadb_cluster: backuptest-04
      mariadb_version: 12
      instances: 2
      cores: 2
      ram: 4096
      storage_size: 30480
      state: update
      wait: true
    register: updated_cluster_response
  

Available parameters for state update:

NameRequiredDescription

maintenance_window dict

False

A weekly 4 hour-long window, during which maintenance might occur.

mariadb_version str

False

The MariaDB version of your cluster.

instances int

False

The total number of instances in the cluster (one master and n-1 standbys).

cores int

False

The number of CPU cores per instance.

ram int

False

The amount of memory per instance in megabytes. Has to be a multiple of 1024.

storage_size int

False

The amount of storage per instance in megabytes.

display_name str

False

The friendly name of your cluster.

mariadb_cluster str

True

The ID or name of an existing MariaDB Cluster.

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:

NameRequiredDescription

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