• Blog
  • Ansible community forum
  • Documentation
Ansible Logo
Ansible Community Documentation
Ansible

Ansible getting started

  • Getting started with Ansible
  • Getting started with Execution Environments

Installation, Upgrade & Configuration

  • Installation Guide
  • Ansible Porting Guides

Using Ansible

  • Building Ansible inventories
  • Using Ansible command line tools
  • Using Ansible playbooks
  • Protecting sensitive data with Ansible vault
  • Using Ansible modules and plugins
  • Using Ansible collections
  • Using Ansible on Windows and BSD
  • Ansible tips and tricks

Contributing to Ansible

  • Ansible Community Guide
  • Ansible Collections Contributor Guide
  • ansible-core Contributors Guide
  • Advanced Contributor Guide
  • Ansible documentation style guide

Extending Ansible

  • Developer Guide

Common Ansible Scenarios

  • Legacy Public Cloud Guides

Network Automation

  • Network Getting Started
  • Network Advanced Topics
  • Network Developer Guide

Ansible Galaxy

  • Galaxy User Guide
  • Galaxy Developer Guide

Reference & Appendices

  • Collection Index
    • Collections in the Amazon Namespace
    • Collections in the Ansible Namespace
    • Collections in the Arista Namespace
    • Collections in the Awx Namespace
    • Collections in the Azure Namespace
    • Collections in the Check_point Namespace
    • Collections in the Chocolatey Namespace
    • Collections in the Cisco Namespace
    • Collections in the Cloud Namespace
    • Collections in the Cloudscale_ch Namespace
    • Collections in the Community Namespace
    • Collections in the Containers Namespace
    • Collections in the Cyberark Namespace
    • Collections in the Dellemc Namespace
    • Collections in the F5networks Namespace
    • Collections in the Fortinet Namespace
    • Collections in the Frr Namespace
    • Collections in the Gluster Namespace
    • Collections in the Google Namespace
    • Collections in the Grafana Namespace
    • Collections in the Hetzner Namespace
    • Collections in the Hitachivantara Namespace
    • Collections in the Hpe Namespace
    • Collections in the Ibm Namespace
    • Collections in the Ieisystem Namespace
    • Collections in the Infinidat Namespace
    • Collections in the Infoblox Namespace
    • Collections in the Inspur Namespace
    • Collections in the Junipernetworks Namespace
    • Collections in the Kaytus Namespace
    • Collections in the Kubernetes Namespace
    • Collections in the Kubevirt Namespace
    • Collections in the Lowlydba Namespace
    • Collections in the Mellanox Namespace
    • Collections in the Microsoft Namespace
    • Collections in the Netapp Namespace
      • Netapp.Cloudmanager
      • Netapp.Ontap
        • Description
        • Plugin Index
      • Netapp.Storagegrid
    • Collections in the Netapp_eseries Namespace
    • Collections in the Netbox Namespace
    • Collections in the Ngine_io Namespace
    • Collections in the Openstack Namespace
    • Collections in the Openvswitch Namespace
    • Collections in the Ovirt Namespace
    • Collections in the Pcg Namespace
    • Collections in the Purestorage Namespace
    • Collections in the Ravendb Namespace
    • Collections in the Sensu Namespace
    • Collections in the Servicenow Namespace
    • Collections in the Splunk Namespace
    • Collections in the T_systems_mms Namespace
    • Collections in the Telekom_mms Namespace
    • Collections in the Theforeman Namespace
    • Collections in the Vmware Namespace
    • Collections in the Vultr Namespace
    • Collections in the Vyos Namespace
    • Collections in the Wti Namespace
  • Indexes of all modules and plugins
  • Playbook Keywords
  • Return Values
  • Ansible Configuration Settings
  • Controlling how Ansible behaves: precedence rules
  • YAML Syntax
  • Python 3 Support
  • Interpreter Discovery
  • Releases and maintenance
  • Testing Strategies
  • Sanity Tests
  • Frequently Asked Questions
  • Glossary
  • Ansible Reference: Module Utilities
  • Special Variables
  • Red Hat Ansible Automation Platform
  • Ansible Automation Hub
  • Logging Ansible output

Roadmaps

  • Ansible Roadmap
  • ansible-core Roadmaps




Ansible
  • Collection Index
  • Collections in the Netapp Namespace
  • Netapp.Ontap
  • netapp.ontap.na_ontap_cg module – NetApp ONTAP module to manage operations related to consistency groups.


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.4.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

  • Requirements

  • Parameters

  • Notes

  • Examples

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:

  • "create"

count

integer

Number of elements to perform the operation on.

size

integer

Specifies the provisioned size in size_unit.

size_unit

string

The unit used to interpret the size parameter.

Choices:

  • "bytes"

  • "b"

  • "kb"

  • "mb"

  • "gb"

  • "tb"

  • "pb"

  • "eb"

  • "zb"

  • "yb"

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:

  • "create"

count

integer

Number of elements to perform the operation on.

size

integer

Specifies the provisioned size in size_unit.

size_unit

string

The unit used to interpret the size parameter.

Choices:

  • "bytes"

  • "b"

  • "kb"

  • "mb"

  • "gb"

  • "tb"

  • "pb"

  • "eb"

  • "zb"

  • "yb"

provisioning_options

dictionary

Options that are applied to the operation.

action

string

Operation to perform.

Choices:

  • "create"

  • "add"

  • "remove"

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:

  • "create"

  • "add"

  • "remove"

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.

size_unit

string

The unit used to interpret the size parameter.

Choices:

  • "bytes"

  • "b"

  • "kb"

  • "mb"

  • "gb"

  • "tb"

  • "pb"

  • "eb"

  • "zb"

  • "yb"

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:

  • false ← (default)

  • true

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:

  • "create"

count

integer

Number of elements to perform the operation on.

size

integer

Specifies the provisioned size in size_unit.

size_unit

string

The unit used to interpret the size parameter.

Choices:

  • "bytes"

  • "b"

  • "kb"

  • "mb"

  • "gb"

  • "tb"

  • "pb"

  • "eb"

  • "zb"

  • "yb"

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:

  • "create"

count

integer

Number of elements to perform the operation on.

size

integer

Specifies the provisioned size in size_unit.

size_unit

string

The unit used to interpret the size parameter.

Choices:

  • "bytes"

  • "b"

  • "kb"

  • "mb"

  • "gb"

  • "tb"

  • "pb"

  • "eb"

  • "zb"

  • "yb"

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:

  • "present" ← (default)

  • "absent"

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:

  • false ← (default)

  • true

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: "always"

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

  1. Basic authentication, using username and password.

  2. SSL certificate authentication, using a ssl client cert file, and optionally a private key file.

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 no, the SSL certificates will not be validated.

This should only set to False used on personally controlled sites using self-signed certificates.

Choices:

  • false

  • true ← (default)

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:

  • "create"

  • "add"

  • "remove"

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.

size_unit

string

The unit used to interpret the size parameter.

Choices:

  • "bytes"

  • "b"

  • "kb"

  • "mb"

  • "gb"

  • "tb"

  • "pb"

  • "eb"

  • "zb"

  • "yb"

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

  • Issue Tracker
  • Homepage
  • Repository (Sources)
Previous Next

© Copyright Ansible project contributors. Last updated on Mar 11, 2026.