|
|
@ -18,10 +18,9 @@ short_description: Manage NetApp Sanpshots
|
|
|
|
extends_documentation_fragment:
|
|
|
|
extends_documentation_fragment:
|
|
|
|
- netapp.na_ontap
|
|
|
|
- netapp.na_ontap
|
|
|
|
version_added: '2.6'
|
|
|
|
version_added: '2.6'
|
|
|
|
author:
|
|
|
|
author: NetApp Ansible Team (ng-ansibleteam@netapp.com)
|
|
|
|
- Chris Archibald (carchi@netapp.com), Kevin Hutton (khutton@netapp.com)
|
|
|
|
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Create/Modify/Delete Ontap snapshots
|
|
|
|
- Create/Modify/Delete ONTAP snapshots
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -60,11 +59,6 @@ options:
|
|
|
|
vserver:
|
|
|
|
vserver:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The Vserver name
|
|
|
|
- The Vserver name
|
|
|
|
new_comment:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
A human readable comment attached with the snapshot.
|
|
|
|
|
|
|
|
The size of the comment can be at most 255 characters.
|
|
|
|
|
|
|
|
This will replace the existing comment
|
|
|
|
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
EXAMPLES = """
|
|
|
|
EXAMPLES = """
|
|
|
|
- name: create SnapShot
|
|
|
|
- name: create SnapShot
|
|
|
@ -96,7 +90,7 @@ EXAMPLES = """
|
|
|
|
na_ontap_snapshot:
|
|
|
|
na_ontap_snapshot:
|
|
|
|
state=present
|
|
|
|
state=present
|
|
|
|
snapshot={{ snapshot name }}
|
|
|
|
snapshot={{ snapshot name }}
|
|
|
|
new_comment="New comments are great"
|
|
|
|
comment="New comments are great"
|
|
|
|
volume={{ vol name }}
|
|
|
|
volume={{ vol name }}
|
|
|
|
vserver={{ vserver name }}
|
|
|
|
vserver={{ vserver name }}
|
|
|
|
username={{ netapp username }}
|
|
|
|
username={{ netapp username }}
|
|
|
@ -133,7 +127,6 @@ class NetAppOntapSnapshot(object):
|
|
|
|
ignore_owners=dict(required=False, type="bool", default=False),
|
|
|
|
ignore_owners=dict(required=False, type="bool", default=False),
|
|
|
|
snapshot_instance_uuid=dict(required=False, type="str"),
|
|
|
|
snapshot_instance_uuid=dict(required=False, type="str"),
|
|
|
|
vserver=dict(required=True, type="str"),
|
|
|
|
vserver=dict(required=True, type="str"),
|
|
|
|
new_comment=dict(required=False, type="str"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
))
|
|
|
|
))
|
|
|
|
self.module = AnsibleModule(
|
|
|
|
self.module = AnsibleModule(
|
|
|
@ -156,9 +149,6 @@ class NetAppOntapSnapshot(object):
|
|
|
|
# these are the optional variables for deleting a snapshot\
|
|
|
|
# these are the optional variables for deleting a snapshot\
|
|
|
|
self.ignore_owners = parameters['ignore_owners']
|
|
|
|
self.ignore_owners = parameters['ignore_owners']
|
|
|
|
self.snapshot_instance_uuid = parameters['snapshot_instance_uuid']
|
|
|
|
self.snapshot_instance_uuid = parameters['snapshot_instance_uuid']
|
|
|
|
# These are the optional for Modify.
|
|
|
|
|
|
|
|
# You can NOT change a snapcenter name
|
|
|
|
|
|
|
|
self.new_comment = parameters['new_comment']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if HAS_NETAPP_LIB is False:
|
|
|
|
if HAS_NETAPP_LIB is False:
|
|
|
|
self.module.fail_json(
|
|
|
|
self.module.fail_json(
|
|
|
@ -231,7 +221,8 @@ class NetAppOntapSnapshot(object):
|
|
|
|
attributes = netapp_utils.zapi.NaElement("attributes")
|
|
|
|
attributes = netapp_utils.zapi.NaElement("attributes")
|
|
|
|
snapshot_info_obj = netapp_utils.zapi.NaElement("snapshot-info")
|
|
|
|
snapshot_info_obj = netapp_utils.zapi.NaElement("snapshot-info")
|
|
|
|
snapshot_info_obj.add_new_child("name", self.snapshot)
|
|
|
|
snapshot_info_obj.add_new_child("name", self.snapshot)
|
|
|
|
snapshot_info_obj.add_new_child("comment", self.new_comment)
|
|
|
|
if self.comment is not None:
|
|
|
|
|
|
|
|
snapshot_info_obj.add_new_child("comment", self.comment)
|
|
|
|
attributes.add_child_elem(snapshot_info_obj)
|
|
|
|
attributes.add_child_elem(snapshot_info_obj)
|
|
|
|
snapshot_obj.add_child_elem(attributes)
|
|
|
|
snapshot_obj.add_child_elem(attributes)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -283,8 +274,8 @@ class NetAppOntapSnapshot(object):
|
|
|
|
if existing_snapshot is not None:
|
|
|
|
if existing_snapshot is not None:
|
|
|
|
if self.state == 'absent':
|
|
|
|
if self.state == 'absent':
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
elif self.state == 'present' and self.new_comment:
|
|
|
|
elif self.state == 'present' and self.comment is not None:
|
|
|
|
if existing_snapshot['comment'] != self.new_comment:
|
|
|
|
if existing_snapshot['comment'] != self.comment:
|
|
|
|
comment_changed = True
|
|
|
|
comment_changed = True
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|