dellemc.unity.snapshot 模块 – 管理 Unity 存储系统上的快照

注意

此模块是 dellemc.unity 集合(版本 2.0.0)的一部分。

如果您使用的是 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install dellemc.unity。您需要进一步的要求才能使用此模块,有关详细信息,请参见要求

要在剧本中使用它,请指定:dellemc.unity.snapshot

dellemc.unity 1.1.0 中的新增功能

概要

  • 管理 Unity 存储系统上的快照包括创建快照、删除快照、更新快照、获取快照、映射主机和取消映射主机。

要求

执行此模块的主机需要以下要求。

  • Dell Unity 存储设备版本 5.1 或更高版本。

  • Ansible-core 2.14 或更高版本。

  • Python 3.9、3.10 或 3.11。

  • Storops Python SDK 1.2.11。

参数

参数

注释

auto_delete

布尔值

此选项指定是否自动删除快照。

如果设置为 true,快照将根据池的自动删除策略过期。

如果设置为 (false),快照将不会根据池的自动删除策略自动删除。

如果指定了 expiry_time,则选项 auto_delete 不能设置为 true

如果在创建期间未提及 auto_deleteexpiry_time,则将创建快照,并将 auto_delete 保留为 true

一旦设置了 expiry_time,则无法将快照分配给自动删除策略。

选项

  • false

  • true

cg_name

字符串

为其创建快照的一致性组的名称。

要创建快照,必须提供 vol_namecg_name

对于其他操作不是必需的。

description

字符串

可以使用此选项提供有关快照的其他信息。

expiry_time

字符串

此选项用于指定快照过期的日期和时间。

时间以 UTC 时区提及。

格式为“MM/DD/YYYY HH:MM”。年份必须为 4 位数字。

host_id

字符串

主机的 ID。

要将快照映射到主机或从主机取消映射,必须提供 host_namehost_id

快照可以附加到多个主机。

host_name

字符串

主机的名称。

要将快照映射到主机或从主机取消映射,必须提供 host_namehost_id

快照可以附加到多个主机。

host_state

字符串

host_state 选项用于提及主机对快照的存在。

当快照映射到主机或从主机取消映射时,这是必需的。

选项

  • "mapped"

  • "unmapped"

new_snapshot_name

字符串

快照的新名称。

password

字符串 / 必需

Unity 管理服务器的密码。

port

整数

与 Unity 管理服务器通信所通过的端口号。

默认值: 443

snapshot_id

字符串

快照的 ID。

对于创建以外的所有操作,必须提供 snapshot_namesnapshot_id

snapshot_name

字符串

快照的名称。

创建快照的强制性参数。

对于所有其他操作,必须提供 snapshot_namesnapshot_id

state

字符串 / 必需

state 选项用于提及快照的存在。

选项

  • "absent"

  • "present"

unispherehost

字符串 / 必需

Unity 管理服务器的 IP 或 FQDN。

username

字符串 / 必需

Unity 管理服务器的用户名。

validate_certs

别名:verifycert

布尔值

布尔变量,用于指定是否验证 SSL 证书。

true - 表示应验证 SSL 证书。

false - 表示不应验证 SSL 证书。

选项

  • false

  • true ← (默认值)

vol_name

字符串

为其创建快照的卷的名称。

要创建快照,必须提供 vol_namecg_name

对于其他操作不是必需的。

说明

注意

  • 不支持 check_mode

  • 此集合中名为“dellemc.unity”的模块旨在支持 Dell Unity 存储平台。

示例

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

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

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

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

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

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

返回值

通用返回值记录在这里,以下是此模块独有的字段。

描述

changed

布尔值

指示资源是否已更改。

返回: 始终

示例: true

snapshot_details

字典

快照的详细信息。

返回: 当快照存在时

示例: {"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"}

expiration_time

字符串

快照到期后的日期和时间。

返回: 成功时

hosts_list

字典

包含关联主机的名称和 ID。

返回: 成功时

id

字符串

快照实例的唯一标识符。

返回: 成功时

is_auto_delete

字符串

为快照提到的附加信息。

返回: 成功时

name

字符串

快照的名称。

返回: 成功时

storage_resource_id

字符串

快照存在的存储资源的 ID。

返回: 成功时

storage_resource_name

字符串

快照存在的存储资源的名称。

返回: 成功时

作者

  • P Srinivas Rao (@srinivas-rao5)