dellemc.unity.consistencygroup 模块 – 在 Unity 存储系统上管理一致性组

注意

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

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

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

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

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。

参数

参数

注释

cg_id

字符串

一致性组的 ID。

它只能用于获取、修改、添加/删除卷或删除操作。

cg_name

字符串

一致性组的名称。

创建操作时必填。

对于任何操作,请指定 *cg_name* 或 *cg_id*(但不能同时指定两者)。

description

字符串

一致性组的描述。

hosts

列表 / 元素=字典

这是一个主机列表。

必须为一致性组的主机映射/取消映射提供主机 ID 或名称。

如果提供了 *hosts*,则也应指定 *mapping_state*。

如果一致性组没有卷,则无法将主机映射到一致性组。

将一致性组映射到主机时,用户不应使用卷模块将一致性组中的卷映射到主机。

host_id

字符串

主机的 ID。

host_name

字符串

主机的名称。

mapping_state

字符串

字符串变量,描述一致性组内主机的状态。

如果提供了 *hosts*,则也应指定 *mapping_state*。

选项

  • "mapped"

  • "unmapped"

new_cg_name

字符串

一致性组的新名称,用于重命名操作。

password

字符串 / 必填

Unity 管理服务器的密码。

port

整数

与 Unity 管理服务器进行通信的端口号。

默认值: 443

replication_params

字典

启用复制所需的设置。

destination_cg_name

字符串

目标一致性组的名称。

默认值为以“DR_”为前缀的源一致性组名称。

destination_pool_id

字符串

分配目标 LUN 的池的 ID。

与 *destination_pool_name* 互斥。

destination_pool_name

字符串

分配目标 LUN 的池的名称。

与 *destination_pool_id* 互斥。

remote_system

字典

正在配置复制到的远程系统的详细信息。

如果 *replication_type* 为 remote,则应指定 *remote_system* 选项。

remote_system_host

字符串 / 必填

远程 Unity Unisphere 主机的 IP 或 FQDN。

remote_system_password

字符串 / 必填

远程 Unity Unisphere 主机的密码。

remote_system_port

整数

托管远程 Unity Unisphere 的端口。

默认值: 443

remote_system_username

字符串 / 必填

远程 Unity Unisphere 主机的用户名。

remote_system_verifycert

布尔值

布尔变量,用于指定是否验证远程 Unity Unisphere 主机的 SSL 证书。

true - 表示应验证 SSL 证书。

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

选项

  • false

  • true ← (默认)

replication_mode

字符串 / 必填

复制模式。

选项

  • "asynchronous"

  • "manual"

replication_type

字符串

复制类型。

选项

  • "local" ← (默认)

  • "remote"

rpo

整数

系统同步源 LUN 和目标 LUN 之前等待的最长时间。

如果 *replication_mode* 为 asynchronous,则应指定 *rpo* 选项。

值应在 51440 的范围内。

replication_state

字符串

复制的状态。

选项

  • "enable"

  • "disable"

snap_schedule

字符串

分配给一致性组的快照计划。

指定空字符串“”会从一致性组中删除现有的快照计划。

state

字符串 / 必填

定义一致性组是否存在。

选项

  • "absent"

  • "present"

tiering_policy

字符串

分层策略选项,用于确定存储资源数据如何在池中可用的层之间分配。

选项

  • "AUTOTIER_HIGH"

  • "AUTOTIER"

  • "HIGHEST"

  • "LOWEST"

unispherehost

字符串 / 必填

Unity 管理服务器的 IP 或 FQDN。

username

字符串 / 必填

Unity 管理服务器的用户名。

validate_certs

别名:verifycert

布尔值

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

true - 表示应验证 SSL 证书。

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

选项

  • false

  • true ← (默认)

vol_state

字符串

字符串变量,描述一致性组内卷的状态。

如果提供了 *volumes*,则也应指定 *vol_state*。

选项

  • "present-in-group"

  • "absent-in-group"

volumes

列表 / 元素=字典

这是一个卷列表。

必须为从一致性组添加/删除现有卷提供卷 ID 或名称。

如果提供了 *volumes*,则也应指定 *vol_state*。

如果一致性组或卷具有快照,则无法从一致性组添加/删除卷。

vol_id

字符串

卷的 ID。

vol_name

字符串

卷的名称。

注释

注意

  • 不支持check_mode

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

示例

- name: Create consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      validate_certs: "{{validate_certs}}"
      username: "{{username}}"
      password: "{{password}}"
      cg_name: "{{cg_name}}"
      description: "{{description}}"
      snap_schedule: "{{snap_schedule1}}"
      state: "present"

- name: Get details of consistency group using id
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_id: "{{cg_id}}"
      state: "present"

- name: Add volumes to consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_id: "{{cg_id}}"
      volumes:
          - vol_name: "Ansible_Test-3"
          - vol_id: "sv_1744"
      vol_state: "{{vol_state_present}}"
      state: "present"

- name: Rename consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_name: "{{cg_name}}"
      new_cg_name: "{{new_cg_name}}"
      state: "present"

- name: Modify consistency group details
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_name: "{{new_cg_name}}"
      snap_schedule: "{{snap_schedule2}}"
      tiering_policy: "{{tiering_policy1}}"
      state: "present"

- name: Map hosts to a consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_id: "{{cg_id}}"
      hosts:
          - host_name: "10.226.198.248"
          - host_id: "Host_511"
      mapping_state: "mapped"
      state: "present"

- name: Unmap hosts from a consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_id: "{{cg_id}}"
      hosts:
          - host_id: "Host_511"
          - host_name: "10.226.198.248"
      mapping_state: "unmapped"
      state: "present"

- name: Remove volumes from consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_name: "{{new_cg_name}}"
      volumes:
          - vol_name: "Ansible_Test-3"
          - vol_id: "sv_1744"
      vol_state: "{{vol_state_absent}}"
      state: "present"

- name: Delete consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_name: "{{new_cg_name}}"
      state: "absent"

- name: Enable replication for consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_id: "cg_id_1"
      replication_params:
          destination_cg_name: "destination_cg_1"
          replication_mode: "asynchronous"
          rpo: 60
          replication_type: "remote"
          remote_system:
              remote_system_host: '10.1.2.3'
              remote_system_verifycert: false
              remote_system_username: 'username'
              remote_system_password: 'password'
          destination_pool_name: "pool_test_1"
      replication_state: "enable"
      state: "present"

- name: Disable replication for consistency group
  dellemc.unity.consistencygroup:
      unispherehost: "{{unispherehost}}"
      username: "{{username}}"
      password: "{{password}}"
      validate_certs: "{{validate_certs}}"
      cg_name: "dis_repl_ans_source"
      replication_state: "disable"
      state: "present"

返回值

常见的返回值已在此处记录,以下是此模块特有的字段

描述

changed

布尔值

资源是否已更改。

返回:始终

示例: true

consistency_group_details

字典

一致性组的详细信息。

返回:一致性组存在时

示例: {"advanced_dedup_status": "DedupStatusEnum.DISABLED", "block_host_access": null, "cg_replication_enabled": false, "data_reduction_percent": 0, "data_reduction_ratio": 1.0, "data_reduction_size_saved": 0, "data_reduction_status": "DataReductionStatusEnum.DISABLED", "datastores": null, "dedup_status": null, "description": "Ansible testing", "esx_filesystem_block_size": null, "esx_filesystem_major_version": null, "existed": true, "filesystem": null, "hash": 8776023812033, "health": {"UnityHealth": {"hash": 8776023811889}}, "host_v_vol_datastore": null, "id": "res_7477", "is_replication_destination": false, "is_snap_schedule_paused": null, "luns": null, "metadata_size": 0, "metadata_size_allocated": 0, "name": "Ansible_CG_Testing", "per_tier_size_used": null, "pools": null, "relocation_policy": "TieringPolicyEnum.MIXED", "replication_type": "ReplicationTypeEnum.NONE", "size_allocated": 0, "size_total": 0, "size_used": null, "snap_count": 0, "snap_schedule": null, "snaps_size_allocated": 0, "snaps_size_total": 0, "snapshots": [], "thin_status": "ThinStatusEnum.FALSE", "type": "StorageResourceTypeEnum.CONSISTENCY_GROUP", "virtual_volumes": null, "vmware_uuid": null}

block_host_access

字典

映射到一致性组的主机的详细信息。

返回:成功

UnityBlockHostAccessList

列表 / 元素=字符串

映射到一致性组的主机列表。

返回:成功

UnityBlockHostAccess

字典

主机的详细信息。

返回:成功

id

字符串

主机的 ID。

返回:成功

name

字符串

主机的名称。

返回:成功

cg_replication_enabled

布尔值

是否启用了复制。

返回:成功

id

字符串

分配给一致性组的系统 ID。

返回:成功

luns

字典

一致性组中卷的详细信息。

返回:成功

UnityLunList

列表 / 元素=字符串

一致性组中卷的列表。

返回:成功

UnityLun

字典

卷的详细信息。

返回:成功

id

字符串

分配给卷的系统 ID。

返回:成功

name

字符串

卷的名称。

返回:成功

relocation_policy

字符串

一致性组的 FAST VP 分层策略。

返回:成功

snap_schedule

字典

应用于一致性组的快照计划。

返回:成功

UnitySnapSchedule

字典

应用于一致性组的快照计划。

返回:成功

id

字符串

分配给快照计划的系统 ID。

返回:成功

name

字符串

快照计划的名称。

返回:成功

snapshots

列表 / 元素=字符串

一致性组快照列表。

返回:成功

creation_time

字符串

拍摄快照的日期和时间。

返回:成功

expirationTime

字符串

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

返回:成功

name

字符串

快照的名称。

返回:成功

storageResource

字典

拍摄快照的存储资源。

返回:成功

UnityStorageResource

字典

存储资源的详细信息。

返回:成功

id

字符串

存储资源的 ID。

返回:成功

作者

  • Akash Shendge (@shenda1)