netapp.ontap.na_ontap_cg module – NetApp ONTAP module to manage operations related to consistency groups.
Note
This module is part of the netapp.ontap collection (version 23.5.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install netapp.ontap. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: netapp.ontap.na_ontap_cg.
New in netapp.ontap 23.4.0
Synopsis
- Create a consistency group with one or more consistency groups having new or existing volumes.
- Modify or delete an existing consistency group.
Requirements
The below requirements are needed on the host that executes this module.
- Ansible 2.9 or later - 2.12 or later is recommended.
- Python3 - 3.9 or later is recommended.
- netapp-lib only when using ZAPI (install using ‘pip install netapp-lib’), Please note that netapp-lib is deprecated and no longer maintained. Proceed at your own risk.
- A physical or virtual clustered Data ONTAP system, the modules support Data ONTAP 9.1 and onward, REST support requires ONTAP 9.6 or later.
Parameters
Parameter | Comments |
|---|---|
cert_filepath string added in netapp.ontap 20.6.0 | path to SSL client cert file (.pem). not supported with python 2.6. |
consistency_groups list / elements=dictionary | List of consistency groups to be included in the consistency group. |
|
luns list / elements=dictionary |
The LUNs array can be used to create or modify LUNs in a consistency group on a new or existing volume that is a member of the consistency group. |
|
lun_maps list / elements=dictionary |
An array of LUN maps. |
|
igroup_initiators list / elements=string |
Lists of the initiators that are members of the group. |
|
igroup_name string |
The name of the initiator group. |
|
os_type string |
The os type for the initiator groups. |
|
name string / required |
The fully qualified path name of the LUN composed of the “/vol” prefix, the volume name, the qtree name (optional), and the base name of the LUN. Example, /vol/volume1/lun1 or /vol/volume1/qtree1/lun1. |
|
os_type string |
The os type for the LUN. |
|
provisioning_options dictionary |
Options that are applied to the operation. Module is not idempotent when ‘count’ option is set as the name is considered a prefix, and a suffix of the form _<N> is generated where N is the next available numeric index, starting with 1. |
|
action string |
Operation to perform. Choices:
|
|
count integer |
Number of elements to perform the operation on. |
|
size integer |
Specifies the provisioned size in |
|
size_unit string |
The unit used to interpret the size parameter. Choices:
|
|
name string / required |
Specifies the name of the consistency group. |
|
namespaces list / elements=dictionary |
The namespaces array can be used to create or modify namespaces in a consistency group. |
|
name string / required |
The name of the NVMe namespace, of the form “/vol/<volume>[/<qtree>]/<namespace>” where the qtree name is optional. Example, /vol/volume1/namespace1 or /vol/volume1/qtree1/namespace1. |
|
os_type string |
The os type for the namespace. |
|
provisioning_options dictionary |
Options that are applied to the operation. Module is not idempotent when ‘count’ option is set as the name is considered a prefix, and a suffix of the form _<N> is generated where N is the next available numeric index, starting with 1. |
|
action string |
Operation to perform. Choices:
|
|
count integer |
Number of elements to perform the operation on. |
|
size integer |
Specifies the provisioned size in |
|
size_unit string |
The unit used to interpret the size parameter. Choices:
|
|
provisioning_options dictionary |
Options that are applied to the operation. |
|
action string |
Operation to perform. Choices:
|
|
name string |
New name for consistency group. Required to resolve naming collisions. Requires ONTAP 9.13.1 or later. |
|
qos_policy string |
Specifies the QoS policy for the consistency group. Only supported when provisioning new objects. |
|
snapshot_policy string |
Specifies the snapshot policy for the consistency group. |
|
volumes list / elements=dictionary |
List of volumes to be included in the consistency group. The volumes array can be used to create new volumes in the consistency group, add existing volumes to the consistency group. A volume can only be associated with one direct parent consistency group. |
|
name string / required |
Specifies the name of the volume. |
|
provisioning_options dictionary |
Options that are applied to the operation. Module is not idempotent when ‘count’ option is set as the name is considered a prefix, and a suffix of the form _<N> is generated where N is the next available numeric index, starting with 1. |
|
action string |
Operation to perform on the volume. Choices:
|
|
count integer |
Number of elements to perform the operation on. |
|
qos_policy string |
The QoS policy for this volume. Only supported when provisioning new objects. |
|
size integer |
Specifies the provisioned size of the volume in |
|
size_unit string |
The unit used to interpret the size parameter. Choices:
|
|
snapshot_policy string |
The snapshot policy for this volume. |
feature_flags dictionary added in netapp.ontap 20.5.0 | Enable or disable a new feature. This can be used to enable an experimental feature or disable a new feature that breaks backward compatibility. Supported keys and values are subject to change without notice. Unknown keys are ignored. |
force_ontap_version string added in netapp.ontap 21.23.0 | Override the cluster ONTAP version when using REST. The behavior is undefined if the version does not match the target cluster. This is provided as a work-around when the cluster version cannot be read because of permission issues. See https://github.com/ansible-collections/netapp.ontap/wiki/Known-issues. This should be in the form 9.10 or 9.10.1 with each element being an integer number. |
hostname string / required | The hostname or IP address of the ONTAP instance. |
http_port integer | Override the default port (80 or 443) with this port |
https boolean | Enable and disable https. Ignored when using REST as only https is supported. Ignored when using SSL certificate authentication as it requires SSL. Choices:
|
key_filepath string added in netapp.ontap 20.6.0 | path to SSL client key file. |
luns list / elements=dictionary | The LUNs array can be used to create or modify LUNs in a consistency group on a new or existing volume that is a member of the consistency group. |
|
lun_maps list / elements=dictionary |
An array of LUN maps. |
|
igroup_initiators list / elements=string |
Lists of the initiators that are members of the group. |
|
igroup_name string |
The name of the initiator group. |
|
os_type string |
The os type for the initiator groups. |
|
name string / required |
The fully qualified path name of the LUN composed of the “/vol” prefix, the volume name, the qtree name (optional), and the base name of the LUN. Example, /vol/volume1/lun1 or /vol/volume1/qtree1/lun1. |
|
os_type string |
The os type for the LUN. |
|
provisioning_options dictionary |
Options that are applied to the operation. Module is not idempotent when ‘count’ option is set as the name is considered a prefix, and a suffix of the form _<N> is generated where N is the next available numeric index, starting with 1. |
|
action string |
Operation to perform. Choices:
|
|
count integer |
Number of elements to perform the operation on. |
|
size integer |
Specifies the provisioned size in |
|
size_unit string |
The unit used to interpret the size parameter. Choices:
|
name string / required | Specifies the name of the consistency group. The consistency group name must be unique within an SVM. |
namespaces list / elements=dictionary | The namespaces array can be used to create or modify namespaces in a consistency group. |
|
name string / required |
The name of the NVMe namespace, of the form “/vol/<volume>[/<qtree>]/<namespace>” where the qtree name is optional. Example, /vol/volume1/namespace1 or /vol/volume1/qtree1/namespace1. |
|
os_type string |
The os type for the namespace. |
|
provisioning_options dictionary |
Options that are applied to the operation. Module is not idempotent when ‘count’ option is set as the name is considered a prefix, and a suffix of the form _<N> is generated where N is the next available numeric index, starting with 1. |
|
action string |
Operation to perform. Choices:
|
|
count integer |
Number of elements to perform the operation on. |
|
size integer |
Specifies the provisioned size in |
|
size_unit string |
The unit used to interpret the size parameter. Choices:
|
password aliases: pass string | Password for the specified user. |
qos_policy string | Specifies the QoS policy for the consistency group. Only supported when provisioning new objects. |
snapshot_policy string | Specifies the snapshot policy for the consistency group. |
state string | Specifies whether to create, modify, or delete a consistency group. Choices:
|
use_lambda boolean added in netapp.ontap 23.4.0 | Specifies if AWS Lambda proxy functionality should be used to connect to the ONTAP system. Supported only with REST. Choices:
|
use_rest string | This module only supports REST. always -- will always use the REST API. A warning is issued if the module does not support REST. Default: |
username aliases: user string | This can be a Cluster-scoped or SVM-scoped account, depending on whether a Cluster-level or SVM-level API is required. For more information, please read the documentation https://docs.netapp.com/us-en/ontap/authentication/create-svm-user-accounts-task.html. Two authentication methods are supported
To use a certificate, the certificate must have been installed in the ONTAP cluster, and cert authentication must have been enabled. |
validate_certs boolean | If set to This should only set to Choices:
|
volumes list / elements=dictionary | List of volumes to be included in the consistency group. The volumes array can be used to create new volumes in the consistency group, add existing volumes to the consistency group. A volume can only be associated with one direct parent consistency group. Removing all volumes from a consistency group will automatically delete the consistency group. |
|
name string / required |
Specifies the name of the volume. |
|
provisioning_options dictionary |
Options that are applied to the operation. Module is not idempotent when ‘count’ option is set as the name is considered a prefix, and a suffix of the form _<N> is generated where N is the next available numeric index, starting with 1. |
|
action string |
Operation to perform on the volume. Choices:
|
|
count integer |
Number of elements to perform the operation on. |
|
qos_policy string |
The QoS policy for this volume. Only supported when provisioning new objects. |
|
size integer |
Specifies the provisioned size of the volume in |
|
size_unit string |
The unit used to interpret the size parameter. Choices:
|
|
snapshot_policy string |
The snapshot policy for this volume. |
vserver string / required | Specifies the SVM in which the consistency group is located. |
Notes
Note
- Only supported with REST and requires ONTAP 9.10.1 or later.
- Update operation will never delete storage elements. Mapping or unmapping a consistency group from igroups or subsystems is not supported.
- Delete operation will not delete any associated volumes or LUNs. To delete those elements, use the appropriate object associated modules.
- The modules prefixed with na_ontap are built to support the ONTAP storage platform.
- https is enabled by default and recommended. To enable http on the cluster you must run the following commands ‘set -privilege advanced;’ ‘system services web modify -http-enabled true;’
Examples
- name: Creating a single consistency group with a new SAN volume
netapp.ontap.na_ontap_cg:
state: present
vserver: svm1
name: test_cg1
volumes:
- name: test_vol1
size: 50
size_unit: mb
provisioning_options:
action: create
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
- name: Adding an existing volume to an existing consistency group
netapp.ontap.na_ontap_cg:
state: present
vserver: svm1
name: test_cg1
volumes:
- name: test_vol2
provisioning_options:
action: add
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
- name: Adding LUNs to an existing volume in an existing consistency group
netapp.ontap.na_ontap_cg:
state: present
vserver: svm1
name: test_cg1
luns:
- name: "/vol/test_vol2/new_lun"
size: 5
size_unit: mb
os_type: linux
provisioning_options:
action: create
lun_maps:
- igroup_name: new_igroup1
igroup_initiators:
- iqn.1995-08.com.example:new-initiator1
os_type: linux
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
- name: Adding namespaces to an existing volume in an existing consistency group
netapp.ontap.na_ontap_cg:
state: present
vserver: svm1
name: test_cg1
namespaces:
- name: "/vol/test_vol2/new_namespace"
size: 5
size_unit: mb
os_type: linux
provisioning_options:
action: create
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
- name: Deleting a CG (consistency group)
netapp.ontap.na_ontap_cg:
state: absent
vserver: svm1
name: test_cg1
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
- name: Creating a parent CG with two child consistency groups with existing SAN volumes
netapp.ontap.na_ontap_cg:
state: present
vserver: svm1
name: parent_cg
consistency_groups:
- name: child_1
volumes:
- name: test_vol1
provisioning_options:
action: add
- name: child_2
volumes:
- name: test_vol2
provisioning_options:
action: add
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
- name: Removing a child consistency group from nested CG
netapp.ontap.na_ontap_cg:
state: present
vserver: svm1
name: parent_cg
consistency_groups:
- name: child_2
provisioning_options:
action: remove
name: new_single_cg
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
- name: Creating a parent CG with a new child CG with existing volumes
netapp.ontap.na_ontap_cg:
state: present
vserver: svm1
name: parent_cg
consistency_groups:
- name: child_1
provisioning_options:
action: create
volumes:
- name: test_vol1
provisioning_options:
action: add
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: "{{ validate_certs }}"
Authors
- NetApp Ansible Team (@carchi8py)
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/netapp/ontap/na_ontap_cg_module.html