dellemc / dellemc.powerflex / 2.3.0 / module / snapshot_policy Manage snapshot policies on Dell PowerFlex | "added in version" 1.7.0 of dellemc.powerflex" Authors: Trisha Datta (@trisha-dell) <ansible.team@dell.com>dellemc.powerflex.snapshot_policy (2.3.0) — module
Install with ansible-galaxy collection install dellemc.powerflex:==2.3.0
collections: - name: dellemc.powerflex version: 2.3.0
Managing snapshot policies on PowerFlex storage system includes creating, getting details, modifying attributes, adding a source volume, removing a source volume and deleting a snapshot policy.
- name: Create a snapshot policy dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "snapshot_policy_name_1" access_mode: "READ_WRITE" secure_snapshots: false auto_snapshot_creation_cadence: time: 1 unit: "Hour" num_of_retained_snapshots_per_level: - 20 state: "present"
- name: Get snapshot policy details using name dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "snapshot_policy_name_1"
- name: Get snapshot policy details using id dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_id: "snapshot_policy_id_1"
- name: Modify a snapshot policy dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "snapshot_policy_name_1" auto_snapshot_creation_cadence: time: 2 unit: "Hour" num_of_retained_snapshots_per_level: - 40
- name: Rename a snapshot policy dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "snapshot_policy_name_1" new_name: "snapshot_policy_name_1_new"
- name: Add source volume dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "snapshot_policy_name_1" source_volume: - name: "source_volume_name_1" - id: "source_volume_id_2" state: "present"
- name: Remove source volume dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "{{snapshot_policy_name}}" source_volume: - name: "source_volume_name_1" auto_snap_removal_action: 'Remove' state: "absent" - id: "source_volume_id_2" auto_snap_removal_action: 'Remove' detach_locked_auto_snapshots: true state: "absent"
- name: Pause a snapshot policy dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "{{snapshot_policy_name}}" pause: true
- name: Resume a snapshot policy dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "{{snapshot_policy_name}}" pause: false
- name: Delete a snapshot policy dellemc.powerflex.snapshot_policy: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: "{{validate_certs}}" snapshot_policy_name: "snapshot_policy_name" state: "absent"
port: default: 443 description: - Port number through which communication happens with PowerFlex host. type: int pause: description: - Whether to pause or resume the snapshot policy. type: bool state: choices: - present - absent default: present description: - State of the snapshot policy. type: str timeout: default: 120 description: - Time after which connection will get terminated. - It is to be mentioned in seconds. required: false type: int hostname: aliases: - gateway_host description: - IP or FQDN of the PowerFlex host. required: true type: str new_name: description: - New name of the snapshot policy. type: str password: description: - The password of the PowerFlex host. required: true type: str username: description: - The username of the PowerFlex host. required: true type: str access_mode: choices: - READ_WRITE - READ_ONLY description: - Access mode of the snapshot policy. type: str source_volume: description: - The source volume details to be added or removed. elements: dict suboptions: auto_snap_removal_action: choices: - Remove - Detach description: - Ways to handle the snapshots created by the policy (auto snapshots). - Must be provided when I(state) is set to C('absent'). type: str detach_locked_auto_snapshots: description: - Whether to detach the locked auto snapshots during removal of source volume. type: bool id: description: - The unique identifier of the source volume to be added or removed. - Mutually exclusive with I(name). type: str name: description: - The name of the source volume to be added or removed. - Mutually exclusive with I(id). type: str state: choices: - present - absent default: present description: - The state of the source volume. - When C(present), source volume will be added to the snapshot policy. - When C(absent), source volume will be removed from the snapshot policy. type: str type: list validate_certs: aliases: - verifycert default: true description: - Boolean variable to specify whether or not to validate SSL certificate. - C(true) - Indicates that the SSL certificate should be verified. - C(false) - Indicates that the SSL certificate should not be verified. type: bool secure_snapshots: description: - Whether to secure snapshots or not. - Used only in the create operation. type: bool snapshot_policy_id: description: - The unique identifier of the snapshot policy. - Except create operation, all other operations can be performed using I(snapshot_policy_id). - Mutually exclusive with I(snapshot_policy_name). type: str snapshot_policy_name: description: - The name of the snapshot policy. - It is unique across the PowerFlex array. - Mutually exclusive with I(snapshot_policy_id). type: str auto_snapshot_creation_cadence: description: - The auto snapshot creation cadence of the snapshot policy. suboptions: time: description: - The time between creation of two snapshots. type: int unit: choices: - Minute - Hour - Day - Week default: Minute description: - The unit of the auto snapshot creation cadence. type: str type: dict num_of_retained_snapshots_per_level: description: - Number of retained snapshots per level. elements: int type: list
changed: description: Whether or not the resource has changed. returned: always sample: 'false' type: bool snapshot_policy_details: contains: autoSnapshotCreationCadenceInMin: description: The snapshot rule of the snapshot policy. type: int id: description: The ID of the snapshot policy. type: str lastAutoSnapshotCreationFailureReason: description: The reason for the failure of last auto snapshot creation . type: str lastAutoSnapshotFailureInFirstLevel: description: Whether the last auto snapshot in first level failed. type: bool maxVTreeAutoSnapshots: description: Maximum number of VTree auto snapshots. type: int name: description: Name of the snapshot policy. type: str nextAutoSnapshotCreationTime: description: The time of creation of the next auto snapshot. type: int numOfAutoSnapshots: description: Number of auto snapshots. type: int numOfCreationFailures: description: Number of creation failures. type: int numOfExpiredButLockedSnapshots: description: Number of expired but locked snapshots. type: int numOfLockedSnapshots: description: Number of locked snapshots. type: int numOfRetainedSnapshotsPerLevel: description: Number of snapshots retained per level type: list numOfSourceVolumes: description: Number of source volumes. type: int secureSnapshots: description: Whether the snapshots are secured. type: bool snapshotAccessMode: description: Access mode of the snapshots. type: str snapshotPolicyState: description: State of the snapshot policy. type: str statistics: contains: autoSnapshotVolIds: description: Volume Ids of all the auto snapshots. type: list expiredButLockedSnapshotsIds: description: Ids of expired but locked snapshots. type: list numOfAutoSnapshots: description: Number of auto snapshots. type: int numOfExpiredButLockedSnapshots: description: Number of expired but locked snapshots. type: int numOfSrcVols: description: Number of source volumes. type: int srcVolIds: description: Ids of the source volumes. type: list description: Statistics details of the snapshot policy. type: dict systemId: description: Unique identifier of the PowerFlex system. type: str timeOfLastAutoSnapshot: description: Time of the last auto snapshot creation. type: str timeOfLastAutoSnapshotCreationFailure: description: Time of the failure of the last auto snapshot creation. type: str description: Details of the snapshot policy. returned: When snapshot policy exists sample: autoSnapshotCreationCadenceInMin: 120 id: 15ae842800000004 lastAutoSnapshotCreationFailureReason: NR lastAutoSnapshotFailureInFirstLevel: false links: - href: /api/instances/SnapshotPolicy::15ae842800000004 rel: self - href: /api/instances/SnapshotPolicy::15ae842800000004/relationships/Statistics rel: /api/SnapshotPolicy/relationship/Statistics - href: /api/instances/SnapshotPolicy::15ae842800000004/relationships/SourceVolume rel: /api/SnapshotPolicy/relationship/SourceVolume - href: /api/instances/SnapshotPolicy::15ae842800000004/relationships/AutoSnapshotVolume rel: /api/SnapshotPolicy/relationship/AutoSnapshotVolume - href: /api/instances/System::0e7a082862fedf0f rel: /api/parent/relationship/systemId maxVTreeAutoSnapshots: 40 name: Sample_snapshot_policy_1 nextAutoSnapshotCreationTime: 1683709201 numOfAutoSnapshots: 0 numOfCreationFailures: 0 numOfExpiredButLockedSnapshots: 0 numOfLockedSnapshots: 0 numOfRetainedSnapshotsPerLevel: - 40 numOfSourceVolumes: 0 secureSnapshots: false snapshotAccessMode: ReadWrite snapshotPolicyState: Active statistics: autoSnapshotVolIds: [] expiredButLockedSnapshotsIds: [] numOfAutoSnapshots: 0 numOfExpiredButLockedSnapshots: 0 numOfSrcVols: 0 srcVolIds: [] systemId: 0e7a082862fedf0f timeOfLastAutoSnapshot: 0 timeOfLastAutoSnapshotCreationFailure: 0 type: dict