consistency_group – Manage PowerVC Consistency Groups

Synopsis

Create, update, fetch, and delete PowerVC Storage Consistency Groups.

Supports adding and removing volumes during update operations.

Uses group ID for update and delete operations.

Parameters

id (optional, str, None)

ID of the consistency group.

Required for update and delete operations.

name (optional, str, None)

Name of the consistency group.

Required for create operation.

Can be updated.

description (optional, str, None)

Description of the consistency group.

group_type (optional, str, None)

Group type of the consistency group.

storage_templates (optional, list, None)

List of storage templates (volume types).

volume_names (optional, list, None)

List of volume names.

Mutually exclusive with volume_ids.

volume_ids (optional, list, None)

List of volume IDs.

Mutually exclusive with volume_names.

delete_volumes (optional, bool, True)

Whether to delete associated volumes during group deletion.

state (optional, str, present)

Desired state of the consistency group.

update (optional, dict, None)

Modify an existing consistency group.

Allows adding and/or removing volumes.

Both add and remove sections are optional.

add (optional, dict, None)

Volumes to add to the consistency group.

volume_names (optional, list, None)

List of volume names to add.

volume_ids (optional, list, None)

List of volume IDs to add.

remove (optional, dict, None)

Volumes to remove from the consistency group.

volume_names (optional, list, None)

List of volume names to remove.

volume_ids (optional, list, None)

List of volume IDs to add.

Examples

# ==========================================================
# CREATE OPERATIONS
# ==========================================================

- name: Create a Consistency Group using Volume Names
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Create Consistency Group
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        name: "CG_WITH_NAMES"
        group_type: "GROUP_TYPE"
        volume_names:
          - Volume1
          - Volume2
        storage_templates:
          - TEMPLATE1
        description: "Created using volume names"
      register: output

    - debug:
        var: output


- name: Create a Consistency Group using Volume IDs
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Create Consistency Group using IDs
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        name: "CG_WITH_IDS"
        group_type: "GROUP_TYPE"
        volume_ids:
          - 1111-aaaa-bbbb
          - 2222-cccc-dddd
        description: "Created using volume IDs"
      register: output

    - debug:
        var: output


- name: Create a Consistency Group using Storage Templates only
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Create Consistency Group with templates
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        name: "CG_WITH_TEMPLATE"
        storage_templates:
          - TEMPLATE1
        description: "Created using storage template"
      register: output

    - debug:
        var: output


# ==========================================================
# GET OPERATIONS
# ==========================================================

- name: Get all Consistency Groups
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Fetch all groups
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
      register: output

    - debug:
        var: output


- name: Get specific Consistency Group by ID
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Fetch specific group
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
      register: output

    - debug:
        var: output


# ==========================================================
# UPDATE OPERATIONS (Requires ID)
# ==========================================================

- name: Rename an existing Consistency Group
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Rename CG
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        name: "NEW_NAME"
      register: output

    - debug:
        var: output


- name: Update Description of a Consistency Group
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Update description
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        description: "Updated description"
      register: output

    - debug:
        var: output


- name: Update Name and Description together
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Update both fields
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        name: "UPDATED_NAME"
        description: "Updated description"
      register: output

    - debug:
        var: output


- name: Add Volumes by ID
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Add volumes
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        update:
          add:
            volume_ids:
              - 1111-aaaa-bbbb
      register: output

    - debug:
        var: output


- name: Remove Volumes by Name
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Remove volumes
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        update:
          remove:
            volume_names:
              - Volume1
      register: output

    - debug:
        var: output


- name: Add and Remove Volumes together (IDs)
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Modify volumes
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        update:
          add:
            volume_ids:
              - 1111-aaaa-bbbb
          remove:
            volume_ids:
              - 2222-cccc-dddd
      register: output

    - debug:
        var: output


- name: Add and Remove Volumes together (Names)
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Modify volumes by names
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        update:
          add:
            volume_names:
              - Volume2
          remove:
            volume_names:
              - Volume3
      register: output

    - debug:
        var: output


# ==========================================================
# DELETE OPERATIONS
# ==========================================================

- name: Delete Consistency Group (default deletes volumes)
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Delete CG
      ibm.powervc.consistency_group:
        cloud: "CLOUD"
        id: "CG_ID"
        state: absent
      register: output

    - debug:
        var: output

Status

Authors

  • Karteesh Kumar Vipparapelli (@vkarteesh)