W3cubDocs

/Ansible 2.10

netapp.ontap.na_ontap_volume – NetApp ONTAP manage volumes.

Note

This plugin is part of the netapp.ontap collection.

To install it use: ansible-galaxy collection install netapp.ontap.

To use it in a playbook, specify: netapp.ontap.na_ontap_volume.

New in version 2.6.0: of netapp.ontap

Synopsis

  • Create or destroy or modify volumes on NetApp ONTAP.

Requirements

The below requirements are needed on the host that executes this module.

  • 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.
  • Ansible 2.6
  • Ansible 2.9 or later is strongly recommended as it enables the new collection delivery system.
  • Python2 netapp-lib (2017.10.30) or later. Install using ‘pip install netapp-lib’
  • Python3 netapp-lib (2018.11.13) or later. Install using ‘pip install netapp-lib’
  • netapp-lib 2020.3.12 is strongly recommended as it provides better error reporting for connection issues.
  • To enable http on the cluster you must run the following commands ‘set -privilege advanced;’ ‘system services web modify -http-enabled true;’

Parameters

Parameter Choices/Defaults Comments
aggr_list
list / elements=string
added in 2.8.0 of netapp.ontap
an array of names of aggregates to be used for FlexGroup constituents.
aggr_list_multiplier
integer
added in 2.8.0 of netapp.ontap
The number of times to iterate over the aggregates listed with the aggr_list parameter when creating a FlexGroup.
aggregate_name
string
The name of the aggregate the flexvol should exist on.
Required when state=present.
atime_update
boolean
added in 2.8.0 of netapp.ontap
    Choices:
  • no
  • yes
This is an advanced option, the default is True.
If false, prevent the update of inode access times when a file is read.
This value is useful for volumes with extremely high read traffic, since it prevents writes to the inode file for the volume from contending with reads from other files.
This field should be used carefully.
That is, use this field when you know in advance that the correct access time for inodes will not be needed for files on that volume.
auto_provision_as
string
added in 2.8.0 of netapp.ontap
    Choices:
  • flexgroup
Automatically provision a FlexGroup volume.
auto_remap_luns
boolean
added in 20.6.0 of netapp.ontap
    Choices:
  • no
  • yes
Flag to control automatic map of LUNs.
cert_filepath
string
added in 20.6.0 of netapp.ontap
path to SSL client cert file (.pem).
not supported with python 2.6.
check_interval
integer
added in 20.6.0 of netapp.ontap
Default:
30
The amount of time in seconds to wait between checks of a volume to see if it has moved successfully.
comment
string
added in 2.9.0 of netapp.ontap
Sets a comment associated with the volume.
cutover_action
string
added in 20.5.0 of netapp.ontap
    Choices:
  • abort_on_failure
  • defer_on_failure
  • force
  • wait
Specifies the action to be taken for cutover.
Possible values are 'abort_on_failure', 'defer_on_failure', 'force' and 'wait'. Default is 'defer_on_failure'.
efficiency_policy
string
added in 2.7.0 of netapp.ontap
Allows a storage efficiency policy to be set on volume creation.
encrypt
boolean
added in 2.7.0 of netapp.ontap
    Choices:
  • no
  • yes
Whether or not to enable Volume Encryption.
feature_flags
dictionary
added in 20.5.0 of netapp.ontap
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_restore
boolean
added in 20.6.0 of netapp.ontap
    Choices:
  • no
  • yes
If this field is set to "true", the Snapshot copy is restored even if the volume has one or more newer Snapshot copies which are currently used as reference Snapshot copy by SnapMirror. If a restore is done in this situation, this will cause future SnapMirror transfers to fail.
Option should only be used along with snapshot_restore.
force_unmap_luns
boolean
added in 20.6.0 of netapp.ontap
    Choices:
  • no
  • yes
Flag to control automatic unmap of LUNs.
from_name
string
added in 2.7.0 of netapp.ontap
Name of the existing volume to be renamed to name.
from_vserver
string
added in 20.6.0 of netapp.ontap
The source vserver of the volume is rehosted.
group_id
integer
added in 20.1.0 of netapp.ontap
The UNIX group ID for the volume. The default value is 0 ('root').
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
    Choices:
  • no
  • yes
Enable and disable https.
Ignored when using REST as only https is supported.
Ignored when using SSL certificate authentication as it requires SSL.
is_infinite
boolean
    Choices:
  • no
  • yes
Set True if the volume is an Infinite Volume. Deleting an infinite volume is asynchronous.
is_online
boolean
    Choices:
  • no
  • yes
Whether the specified volume is online, or not.
junction_path
string
Junction path of the volume.
To unmount, use junction path ''.
key_filepath
string
added in 20.6.0 of netapp.ontap
path to SSL client key file.
language
string
added in 2.8.0 of netapp.ontap
Language to use for Volume
Default uses SVM language
Possible values Language
c POSIX
ar Arabic
cs Czech
da Danish
de German
en English
en_us English (US)
es Spanish
fi Finnish
fr French
he Hebrew
hr Croatian
hu Hungarian
it Italian
ja Japanese euc-j
ja_v1 Japanese euc-j
ja_jp.pck Japanese PCK (sjis)
ja_jp.932 Japanese cp932
ja_jp.pck_v2 Japanese PCK (sjis)
ko Korean
no Norwegian
nl Dutch
pl Polish
pt Portuguese
ro Romanian
ru Russian
sk Slovak
sl Slovenian
sv Swedish
tr Turkish
zh Simplified Chinese
zh.gbk Simplified Chinese (GBK)
zh_tw Traditional Chinese euc-tw
zh_tw.big5 Traditional Chinese Big 5
To use UTF-8 as the NFS character set, append '.UTF-8' to the language code
name
string / required
The name of the volume to manage.
nvfail_enabled
boolean
added in 2.9.0 of netapp.ontap
    Choices:
  • no
  • yes
If true, the controller performs additional work at boot and takeover times if it finds that there has been any potential data loss in the volume's constituents due to an NVRAM failure.
The volume's constituents would be put in a special state called 'in-nvfailed-state' such that protocol access is blocked.
This will cause the client applications to crash and thus prevent access to stale data.
To get out of this situation, the admin needs to manually clear the 'in-nvfailed-state' on the volume's constituents.
ontapi
integer
The ontap api version to use
password
string
Password for the specified user.

aliases: pass
percent_snapshot_space
integer
Amount of space reserved for snapshot copies of the volume.
policy
string
Name of the export policy.
preserve_lun_ids
boolean
added in 20.6.0 of netapp.ontap
    Choices:
  • no
  • yes
If this field is set to "true", LUNs in the volume being restored will remain mapped and their identities preserved such that host connectivity will not be disrupted during the restore operation. I/O's to the LUN will be fenced during the restore operation by placing the LUNs in an unavailable state. Once the restore operation has completed, hosts will be able to resume I/O access to the LUNs.
Option should only be used along with snapshot_restore.
qos_adaptive_policy_group
string
added in 2.9.0 of netapp.ontap
Specifies a QoS adaptive policy group to be set on volume.
qos_policy_group
string
added in 2.9.0 of netapp.ontap
Specifies a QoS policy group to be set on volume.
size
integer
The size of the volume in (size_unit). Required when state=present.
size_unit
string
    Choices:
  • bytes
  • b
  • kb
  • mb
  • gb
  • tb
  • pb
  • eb
  • zb
  • yb
The unit used to interpret the size parameter.
snapdir_access
boolean
added in 2.8.0 of netapp.ontap
    Choices:
  • no
  • yes
This is an advanced option, the default is False.
Enable the visible '.snapshot' directory that is normally present at system internal mount points.
This value also turns on access to all other '.snapshot' directories in the volume.
snapshot_auto_delete
dictionary
added in 20.4.0 of netapp.ontap
A dictionary for the auto delete options and values.
Supported options include 'state', 'commitment', 'trigger', 'target_free_space', 'delete_order', 'defer_delete', 'prefix', 'destroy_list'.
Option 'state' determines if the snapshot autodelete is currently enabled for the volume. Possible values are 'on' and 'off'.
Option 'commitment' determines the snapshots which snapshot autodelete is allowed to delete to get back space. Possible values are 'try', 'disrupt' and 'destroy'.
Option 'trigger' determines the condition which starts the automatic deletion of snapshots. Possible values are 'volume', 'snap_reserve' and DEPRECATED 'space_reserve'.
Option 'target_free_space' determines when snapshot autodelete should stop deleting snapshots. Depending on the trigger, snapshots are deleted till we reach the target free space percentage. Accepts int type.
Option 'delete_order' determines if the oldest or newest snapshot is deleted first. Possible values are 'newest_first' and 'oldest_first'.
Option 'defer_delete' determines which kind of snapshots to delete in the end. Possible values are 'scheduled', 'user_created', 'prefix' and 'none'.
Option 'prefix' can be set to provide the prefix string for the 'prefix' value of the 'defer_delete' option. The prefix string length can be 15 char long.
Option 'destroy_list' is a comma seperated list of services which can be destroyed if the snapshot backing that service is deleted. For 7-mode, the possible values for this option are a combination of 'lun_clone', 'vol_clone', 'cifs_share', 'file_clone' or 'none'. For cluster-mode, the possible values for this option are a combination of 'lun_clone,file_clone' (for LUN clone and/or file clone), 'lun_clone,sfsr' (for LUN clone and/or sfsr), 'vol_clone', 'cifs_share', or 'none'.
snapshot_policy
string
added in 2.8.0 of netapp.ontap
The name of the snapshot policy.
the default policy name is 'default'.
snapshot_restore
string
added in 20.6.0 of netapp.ontap
Name of snapshot to restore from.
Not supported on Infinite Volume.
space_guarantee
string
    Choices:
  • none
  • file
  • volume
Space guarantee style for the volume.
space_slo
string
added in 2.9.0 of netapp.ontap
    Choices:
  • none
  • thick
  • semi-thick
Specifies the space SLO type for the volume. The space SLO type is the Service Level Objective for space management for the volume.
The space SLO value is used to enforce existing volume settings so that sufficient space is set aside on the aggregate to meet the space SLO.
This parameter is not supported on Infinite Volumes.
state
string
    Choices:
  • present
  • absent
Whether the specified volume should exist or not.
tiering_policy
string
added in 2.9.0 of netapp.ontap
    Choices:
  • snapshot-only
  • auto
  • backup
  • none
The tiering policy that is to be associated with the volume.
This policy decides whether the blocks of a volume will be tiered to the capacity tier.
snapshot-only policy allows tiering of only the volume snapshot copies not associated with the active file system.
auto policy allows tiering of both snapshot and active file system user data to the capacity tier.
backup policy on DP volumes allows all transferred user data blocks to start in the capacity tier.
When set to none, the Volume blocks will not be tiered to the capacity tier.
If no value specified, the volume is assigned snapshot only by default.
Requires ONTAP 9.4 or later.
time_out
integer
added in 2.8.0 of netapp.ontap
Default:
180
time to wait for flexGroup creation, modification, or deletion in seconds.
Error out if task is not completed in defined time.
if 0, the request is asynchronous.
default is set to 3 minutes.
type
string
The volume type, either read-write (RW) or data-protection (DP).
unix_permissions
string
added in 2.8.0 of netapp.ontap
Unix permission bits in octal or symbolic format.
For example, 0 is equivalent to ------------, 777 is equivalent to ---rwxrwxrwx,both formats are accepted.
The valid octal value ranges between 0 and 777 inclusive.
use_rest
string
Default:
"auto"
REST API if supported by the target system for all the resources and attributes the module requires. Otherwise will revert to ZAPI.
always -- will always use the REST API
never -- will always use the ZAPI
auto -- will try to use the REST Api
user_id
integer
added in 20.1.0 of netapp.ontap
The UNIX user ID for the volume. The default value is 0 ('root').
username
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://mysupport.netapp.com/NOW/download/software/nmsdk/9.4/.
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.

aliases: user
validate_certs
boolean
    Choices:
  • no
  • yes
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.
volume_security_style
string
    Choices:
  • mixed
  • ntfs
  • unified
  • unix
The security style associated with this volume.
vserver
string / required
Name of the vserver to use.
vserver_dr_protection
string
added in 2.9.0 of netapp.ontap
    Choices:
  • protected
  • unprotected
Specifies the protection type for the volume in a Vserver DR setup.
wait_for_completion
boolean
added in 2.8.0 of netapp.ontap
    Choices:
  • no
  • yes
Set this parameter to 'true' for synchronous execution during create (wait until volume status is online)
Set this parameter to 'false' for asynchronous execution
For asynchronous, execution exits as soon as the request is sent, without checking volume status

Notes

Note

  • The modules prefixed with na\_ontap are built to support the ONTAP storage platform.

Examples

- name: Create FlexVol
  na_ontap_volume:
    state: present
    name: ansibleVolume12
    is_infinite: False
    aggregate_name: ansible_aggr
    size: 100
    size_unit: mb
    user_id: 1001
    group_id: 2002
    space_guarantee: none
    tiering_policy: auto
    policy: default
    percent_snapshot_space: 60
    qos_policy_group: max_performance_gold
    vserver: ansibleVServer
    wait_for_completion: True
    space_slo: none
    nvfail_enabled: False
    comment: ansible created volume
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"

- name: Volume Delete
  na_ontap_volume:
    state: absent
    name: ansibleVolume12
    aggregate_name: ansible_aggr
    vserver: ansibleVServer
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"

- name: Make FlexVol offline
  na_ontap_volume:
    state: present
    name: ansibleVolume
    is_infinite: False
    is_online: False
    vserver: ansibleVServer
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"

- name: Create flexGroup volume manually
  na_ontap_volume:
    state: present
    name: ansibleVolume
    is_infinite: False
    aggr_list: "{{ aggr_list }}"
    aggr_list_multiplier: 2
    size: 200
    size_unit: mb
    space_guarantee: none
    policy: default
    vserver: "{{ vserver }}"
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: False
    unix_permissions: 777
    snapshot_policy: default
    time_out: 0

- name: Create flexGroup volume auto provsion as flex group
  na_ontap_volume:
    state: present
    name: ansibleVolume
    is_infinite: False
    auto_provision_as: flexgroup
    size: 200
    size_unit: mb
    space_guarantee: none
    policy: default
    vserver: "{{ vserver }}"
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: False
    unix_permissions: 777
    snapshot_policy: default
    time_out: 0

- name: Create FlexVol with QoS adaptive
  na_ontap_volume:
    state: present
    name: ansibleVolume15
    is_infinite: False
    aggregate_name: ansible_aggr
    size: 100
    size_unit: gb
    space_guarantee: none
    policy: default
    percent_snapshot_space: 10
    qos_adaptive_policy_group: extreme
    vserver: ansibleVServer
    wait_for_completion: True
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"

- name: Modify volume dr protection (vserver of the volume must be in a snapmirror relationship)
  na_ontap_volume:
    state: present
    name: ansibleVolume
    vserver_dr_protection: protected
    vserver: "{{ vserver }}"
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: False

- name: Modify volume with snapshot auto delete options
  na_ontap_volume:
    state: present
    name: vol_auto_delete
    snapshot_auto_delete:
      state: "on"
      commitment: try
      defer_delete: scheduled
      target_free_space: 30
      destroy_list: lun_clone,vol_clone
      delete_order: newest_first
    aggregate_name: "{{ aggr }}"
    vserver: "{{ vserver }}"
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: False

- name: Move volume with force cutover action
  na_ontap_volume:
    name: ansible_vol
    aggregate_name: aggr_ansible
    cutover_action: force
    vserver: "{{ vserver }}"
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: false

- name: Rehost volume to another vserver auto remap luns
  na_ontap_volume:
    name: ansible_vol
    from_vserver: ansible
    auto_remap_luns: true
    vserver: "{{ vserver }}"
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: false

- name: Rehost volume to another vserver force unmap luns
  na_ontap_volume:
    name: ansible_vol
    from_vserver: ansible
    force_unmap_luns: true
    vserver: "{{ vserver }}"
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: false

- name: Snapshot restore volume
  na_ontap_volume:
    name: ansible_vol
    vserver: ansible
    snapshot_restore: 2020-05-24-weekly
    force_restore: true
    preserve_lun_ids: true
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: false

Authors

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/netapp/ontap/na_ontap_volume_module.html