dellemc.unity.snapshot (2.0.0) — module

Manage snapshots on the Unity storage system

| "added in version" 1.1.0 of dellemc.unity"

Authors: P Srinivas Rao (@srinivas-rao5) <ansible.team@dell.com>

Install collection

Install with ansible-galaxy collection install dellemc.unity:==2.0.0


Add to requirements.yml

  collections:
    - name: dellemc.unity
      version: 2.0.0

Description

Managing snapshots on the Unity storage system includes create snapshot, delete snapshot, update snapshot, get snapshot, map host and unmap host.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a Snapshot for a CG
  dellemc.unity.snapshot:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    port: "{{port}}"
    cg_name: "{{cg_name}}"
    snapshot_name: "{{cg_snapshot_name}}"
    description: "{{description}}"
    auto_delete: false
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a Snapshot for a volume with Host attached
  dellemc.unity.snapshot:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    port: "{{port}}"
    vol_name: "{{vol_name}}"
    snapshot_name: "{{vol_snapshot_name}}"
    description: "{{description}}"
    expiry_time: "04/15/2025 16:30"
    host_name: "{{host_name}}"
    host_state: "mapped"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Unmap a host for a Snapshot
  dellemc.unity.snapshot:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    port: "{{port}}"
    snapshot_name: "{{vol_snapshot_name}}"
    host_name: "{{host_name}}"
    host_state: "unmapped"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Map snapshot to a host
  dellemc.unity.snapshot:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    port: "{{port}}"
    snapshot_name: "{{vol_snapshot_name}}"
    host_name: "{{host_name}}"
    host_state: "mapped"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update attributes of a Snapshot for a volume
  dellemc.unity.snapshot:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    snapshot_name: "{{vol_snapshot_name}}"
    new_snapshot_name: "{{new_snapshot_name}}"
    description: "{{new_description}}"
    host_name: "{{host_name}}"
    host_state: "unmapped"
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete Snapshot of CG
  dellemc.unity.snapshot:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    snapshot_name: "{{cg_snapshot_name}}"
    state: "absent"

Inputs

    
port:
    default: 443
    description:
    - Port number through which communication happens with Unity management server.
    type: int

state:
    choices:
    - absent
    - present
    description:
    - The I(state) option is used to mention the existence of the snapshot.
    required: true
    type: str

cg_name:
    description:
    - The name of the Consistency Group for which snapshot is created.
    - For creation of a snapshot either I(vol_name) or I(cg_name) is required.
    - Not required for other operations.
    type: str

host_id:
    description:
    - The id of the host.
    - Either I(host_name) or I(host_id) is required to map or unmap a snapshot from a
      host.
    - Snapshot can be attached to multiple hosts.
    type: str

password:
    description:
    - The password of the Unity management server.
    required: true
    type: str

username:
    description:
    - The username of the Unity management server.
    required: true
    type: str

vol_name:
    description:
    - The name of the volume for which snapshot is created.
    - For creation of a snapshot either I(vol_name) or I(cg_name) is required.
    - Not required for other operations.
    type: str

host_name:
    description:
    - The name of the host.
    - Either I(host_name) or I(host_id) is required to map or unmap a snapshot from a
      host.
    - Snapshot can be attached to multiple hosts.
    type: str

host_state:
    choices:
    - mapped
    - unmapped
    description:
    - The I(host_state) option is used to mention the existence of the host for snapshot.
    - It is required when a snapshot is mapped or unmapped from host.
    type: str

auto_delete:
    description:
    - This option specifies whether the snapshot is auto deleted or not.
    - If set to C(true), snapshot will expire based on the pool auto deletion policy.
    - If set to (false), snapshot will not be auto deleted based on the pool auto deletion
      policy.
    - Option I(auto_delete) can not be set to C(true), if I(expiry_time) is specified.
    - If during creation neither I(auto_delete) nor I(expiry_time) is mentioned then snapshot
      will be created keeping I(auto_delete) as C(true).
    - Once the I(expiry_time) is set then snapshot cannot be assigned to the auto delete
      policy.
    type: bool

description:
    description:
    - The additional information about the snapshot can be provided using this option.
    type: str

expiry_time:
    description:
    - This option is for specifying the date and time after which the snapshot will expire.
    - The time is to be mentioned in UTC timezone.
    - The format is "MM/DD/YYYY HH:MM". Year must be in 4 digits.
    type: str

snapshot_id:
    description:
    - The id of the snapshot.
    - For all operations other than creation either I(snapshot_name) or I(snapshot_id)
      is required.
    type: str

snapshot_name:
    description:
    - The name of the snapshot.
    - Mandatory parameter for creating a snapshot.
    - For all other operations either I(snapshot_name) or I(snapshot_id) is required.
    type: str

unispherehost:
    description:
    - IP or FQDN of the Unity management server.
    required: true
    type: str

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

new_snapshot_name:
    description:
    - New name for the snapshot.
    type: str

Outputs

changed:
  description: Whether or not the resource has changed.
  returned: always
  sample: true
  type: bool
snapshot_details:
  contains:
    expiration_time:
      description: Date and time after which the snapshot will expire.
      type: str
    hosts_list:
      description: Contains the name and id of the associated hosts.
      type: dict
    id:
      description: Unique identifier of the snapshot instance.
      type: str
    is_auto_delete:
      description: Additional information mentioned for snapshot.
      type: str
    name:
      description: The name of the snapshot.
      type: str
    storage_resource_id:
      description: Id of the storage resource for which the snapshot exists.
      type: str
    storage_resource_name:
      description: Name of the storage resource for which the snapshot exists.
      type: str
  description: Details of the snapshot.
  returned: When snapshot exists
  sample:
    access_type: null
    attached_wwn: null
    creation_time: '2022-10-21 08:20:25.803000+00:00'
    creator_schedule: null
    creator_type: SnapCreatorTypeEnum.USER_CUSTOM
    creator_user:
      id: user_admin
    description: Test snap creation
    existed: true
    expiration_time: null
    hash: 8756689457056
    hosts_list: []
    id: '85899355291'
    io_limit_policy: null
    is_auto_delete: true
    is_modifiable: false
    is_modified: false
    is_read_only: true
    is_system_snap: false
    last_writable_time: null
    lun: null
    name: ansible_snap_cg_1_1
    parent_snap: null
    size: null
    snap_group: null
    state: SnapStateEnum.READY
    storage_resource_id: res_95
    storage_resource_name: CG_ansible_test_2_new
  type: dict