purestorage.flasharray.purefa_host 模块 – 管理 Pure Storage FlashArrays 上的主机

注意

此模块是 purestorage.flasharray 集合(版本 1.32.0)的一部分。

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

要安装它,请使用:ansible-galaxy collection install purestorage.flasharray。您需要进一步的要求才能使用此模块,请参阅 要求 以了解详细信息。

要在 playbook 中使用它,请指定:purestorage.flasharray.purefa_host

purestorage.flasharray 1.0.0 中的新增功能

概要

  • 在 Pure Storage FlashArrays 上创建、删除或修改主机。

要求

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

  • python >= 3.3

  • purestorage >= 1.19

  • py-pure-client >= 1.26.0

  • netaddr

  • requests

  • pycountry

  • urllib3

参数

参数

注释

api_token

字符串

具有管理员权限的用户的 FlashArray API 令牌。

count

整数

在多个主机创建中要创建的主机数

仅从 Purity//FA v6.0.0 及更高版本支持

digits

整数

用于多个主机计数的位数。 这将在必要时使用零填充索引号

仅从 Purity//FA v6.0.0 及更高版本支持

范围在 1 到 10 之间

默认值: 1

disable_warnings

布尔值

在 purestorage.flasharray 1.29.0 中添加

在调试日志中禁用不安全的证书警告

选择

  • false ← (默认)

  • true

fa_url

字符串

FlashArray 管理 IPv4 地址或主机名。

host_password

字符串

设置 CHAP 身份验证的主机密码

密码长度在 12 到 255 个字符之间

要清除用户名/密码对,请使用 clear 作为密码

设置密码不是幂等的

host_user

字符串

设置 CHAP 身份验证的主机用户名

需要 host_password

要清除用户名/密码对,请使用 clear 作为密码

iqn

列表 / 元素=字符串

主机的 IQN 列表。

lun

整数

要分配给主机卷的 LUN ID。 必须是唯一的。

如果未提供,则会自动分配 ID。

LUN ID 的范围是 1 到 4095。

name

别名:host

字符串 / 必需

主机的名称。

请注意,主机名区分大小写,但 FlashArray 主机名是唯一的,并且忽略大小写 - 您不能同时拥有 hostahostA

从 Purity//FA 6.0.0 开始提供多主机支持 ***注意*** 手动删除使用多主机创建的单个主机将导致幂等性失败

多主机支持仅存在于主机创建中

nqn

列表 / 元素=字符串

主机的 NQN 列表。 请注意,NMVe 主机只能拥有 NQN。 这些主机不允许使用多协议。

personality

字符串

定义主机是哪个操作系统。 建议用于 ActiveCluster 集成。

选择

  • "hpux"

  • "vms"

  • "aix"

  • "esxi"

  • "solaris"

  • "hitachi-vsp"

  • "oracle-vm-server"

  • "delete"

  • "" ← (默认)

preferred_array

列表 / 元素=字符串

ActiveCluster 环境中首选阵列的列表。

要从主机中删除现有的首选阵列,请指定 delete

protocol

字符串

定义卷的主机连接协议。

已弃用 不再是必要的参数

选择

  • "fc"

  • "iscsi"

  • "nvme"

  • "mixed"

rename

字符串

要重命名的名称。

请注意,主机名区分大小写,但 FlashArray 主机名是唯一的,并且忽略大小写 - 您不能同时拥有 hostahostA

start

整数

开始多个主机创建索引的数字

仅从 Purity//FA v6.0.0 及更高版本支持

默认值: 0

state

字符串

定义主机是否存在。

删除主机时,所有连接的卷都将被断开连接。

选择

  • "absent"

  • "present" ← (默认)

suffix

字符串

如果需要,用于创建多个主机的后缀字符串

主机名将形成 <name>#<suffix>,其中 # 是主机索引的占位符。 请参阅相关描述

后缀字符串是可选的

仅从 Purity//FA v6.0.0 及更高版本支持

target_password

字符串

设置 CHAP 身份验证的目标密码

密码长度在 12 到 255 个字符之间

要清除用户名/密码对,请使用 clear 作为密码

设置密码不是幂等的

target_user

字符串

设置 CHAP 身份验证的目标用户名

需要 target_password

要清除用户名/密码对,请使用 clear 作为密码

vlan

字符串

在 purestorage.flasharray 1.16.0 中添加

主机关联的 VLAN ID。

如果未设置或设置为 any,则主机可以访问任何 VLAN。

如果设置为 untagged,则主机只能访问未标记的 VLAN。

如果设置为 1 到 4094 之间的数字,则主机只能访问具有该数字的指定 VLAN。

volume

字符串

要映射到主机的卷名称。

wwns

列表 / 元素=字符串

主机的 WWN 列表。

注意

注意

  • 如果指定 lun 选项,请确保主机支持请求的值

  • 此模块需要 purestoragepy-pure-client Python 库

  • 特定模块可能需要其他 Python 库。

  • 如果未直接将 fa_urlapi_token 参数传递给模块,则必须设置 PUREFA_URLPUREFA_API 环境变量

示例

- name: Create new AIX host
  purestorage.flasharray.purefa_host:
    name: foo
    personality: aix
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Create 10 hosts with index starting at 10 but padded with 3 digits
  purestorage.flasharray.purefa_host:
    name: foo
    personality: vms
    suffix: bar
    count: 10
    start: 10
    digits: 3
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: present

- name: Rename host foo to bar
  purestorage.flasharray.purefa_host:
    name: foo
    rename: bar
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Delete host
  purestorage.flasharray.purefa_host:
    name: foo
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: absent

- name: Make host bar with wwn ports
  purestorage.flasharray.purefa_host:
    name: bar
    wwns:
    - 00:00:00:00:00:00:00:00
    - 11:11:11:11:11:11:11:11
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Make host bar with iSCSI ports
  purestorage.flasharray.purefa_host:
    name: bar
    iqn:
    - iqn.1994-05.com.redhat:7d366003913
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Make host bar with NVMe ports
  purestorage.flasharray.purefa_host:
    name: bar
    nqn:
    - nqn.2014-08.com.vendor:nvme:nvm-subsystem-sn-d78432
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Make mixed protocol host
  purestorage.flasharray.purefa_host:
    name: bar
    iqn:
    - iqn.1994-05.com.redhat:7d366003914
    wwns:
    - 00:00:00:00:00:00:00:01
    - 11:11:11:11:11:11:11:12
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Map host foo to volume bar as LUN ID 12
  purestorage.flasharray.purefa_host:
    name: foo
    volume: bar
    lun: 12
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Disconnect volume bar from host foo
  purestorage.flasharray.purefa_host:
    name: foo
    volume: bar
    state: absent
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Add preferred arrays to host foo
  purestorage.flasharray.purefa_host:
    name: foo
    preferred_array:
    - array1
    - array2
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Delete preferred arrays from host foo
  purestorage.flasharray.purefa_host:
    name: foo
    preferred_array: delete
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Delete exisitng WWNs from host foo (does not delete host object)
  purestorage.flasharray.purefa_host:
    name: foo
    wwns: ""
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Set CHAP target and host username/password pairs
  purestorage.flasharray.purefa_host:
    name: foo
    target_user: user1
    target_password: passwrodpassword
    host_user: user2
    host_password: passwrodpassword
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Delete CHAP target and host username/password pairs
  purestorage.flasharray.purefa_host:
    name: foo
    target_user: user
    target_password: clear
    host_user: user
    host_password: clear
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

作者

  • Pure Storage Ansible 团队 (@sdodsley)