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:

state: absent

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

Available parameters for state absent:

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:

state: restore

  

Available parameters for state restore:

Last updated