purestorage.flashblade.purefb_policy 模块 – 管理 FlashBlade 策略

注意

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

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

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

要在 playbook 中使用它,请指定: purestorage.flashblade.purefb_policy

purestorage.flashblade 1.0.0 中的新增功能

摘要

  • 管理文件系统、文件副本链接和对象存储访问的策略。

  • 要更新现有的快照策略规则,必须先删除原始规则,然后添加新规则以替换它。Purity 的最佳匹配将尝试确保在删除第一个规则时删除的任何必需快照都将被恢复,只要在快照清除期过期之前(通常为 24 小时)添加了替换规则。

要求

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

  • python >= 3.9

  • py-pure-client

  • purity_fb >= 1.12.2

  • netaddr

  • datetime

  • pytz

  • distro

  • pycountry

  • urllib3

参数

参数

注释

access

字符串

在 purestorage.flashblade 1.9.0 中添加

指定导出策略规则的访问控制

选项

  • "root-squash" ← (默认)

  • "all-squash"

  • "no-squash"

account

字符串

在 purestorage.flashblade 1.9.0 中添加

对象存储帐户策略适用的名称。

特殊情况 _pure policy_ 用于系统范围的 S3 策略

actions

列表 / 元素=字符串

在 purestorage.flashblade 1.9.0 中添加

要授予的权限列表。

系统范围的策略规则不能删除或修改

选项

  • "s3:*"

  • "s3:AbortMultipartUpload"

  • "s3:BypassGovernanceRetention"

  • "s3:CreateBucket"

  • "s3:DeleteBucket"

  • "s3:DeleteObject"

  • "s3:DeleteObjectVersion"

  • "s3:ExtendSafemodeRetentionPeriod"

  • "s3:GetBucketAcl"

  • "s3:GetBucketLocation"

  • "s3:GetBucketVersioning"

  • "s3:GetLifecycleConfiguration"

  • "s3:GetObject"

  • "s3:GetObjectAcl"

  • "s3:GetObjectLegalHold"

  • "s3:GetObjectLockConfiguration"

  • "s3:GetObjectRetention"

  • "s3:GetObjectTagging"

  • "s3:GetObjectVersion"

  • "s3:GetObjectVersionTagging"

  • "s3:ListAllMyBuckets"

  • "s3:ListBucket"

  • "s3:ListBucketMultipartUploads"

  • "s3:ListBucketVersions"

  • "s3:ListMultipartUploadParts"

  • "s3:PutBucketVersioning"

  • "s3:PutLifecycleConfiguration"

  • "s3:PutObject"

  • "s3:PutObjectLegalHold"

  • "s3:PutObjectLockConfiguration"

  • "s3:PutObjectRetention"

  • "s3:ResolveSafemodeConflicts"

anongid

字符串

在 purestorage.flashblade 1.9.0 中添加

任何其 GID 受 `root_squash` 或 `all_squash` 的 *access* 影响的用户都将拥有其 GID 映射到 anongid。默认的 anongid 为 null,这意味着 65534。使用 “” 清除。

anonuid

字符串

在 purestorage.flashblade 1.9.0 中添加

任何其 UID 受 `root_squash` 或 `all_squash` 的 *access* 影响的用户都将拥有其 UID 映射到 anonuid。默认值为 null,这意味着 65534。使用 “” 清除。

api_token

字符串

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

at

字符串

提供 12 小时 AM/PM 格式的时间,例如 11AM

atime

布尔值

在 purestorage.flashblade 1.9.0 中添加

发生读取操作后,只有在以下任何条件为真时才会更新 inode 访问时间;之前的访问时间小于 inode 修改时间,之前的访问时间小于 inode 更改时间,或者之前的访问时间超过 24 小时。

如果设置为 false,则在读取操作后禁用 inode 访问时间的更新。

选项

  • false

  • true ← (默认)

before_rule

整数

在 purestorage.flashblade 1.9.0 中添加

要插入或移动客户端规则之前的客户端规则的索引。

change

字符串

在 purestorage.flashblade 1.12.0 中添加

SMB 共享主体更改访问权限的状态。

设置为 “” 将清除当前设置

选项

  • "allow"

  • "deny"

  • ""

client

字符串

在 purestorage.flashblade 1.9.0 中添加

指定允许访问导出的客户端。

可接受的表示法是单个 IP 地址、CIDR 表示法中的子网、netgroup 或匿名 (*)。

default_retention

字符串

在 purestorage.flashblade 1.19.0 中添加

用于将文件提交到 WORM 状态的保留期。如果没有提供访问时间,或者访问时间小于当前服务器时间,则将应用此时间。介于 _min_retention_ 和 _max_retention_ 期限之间。

有效值为周 (w)、天 (d)、小时 (h)、分钟 (m) 和秒 (s)。

desc

字符串

在 purestorage.flashblade 1.14.0 中添加

对象存储策略的描述,在创建策略时可选指定。

现有策略无法修改。

默认值: ""

destroy_snapshots

布尔值

在 purestorage.flashblade 1.11.0 中添加

此参数必须设置为 true,才能修改策略,以便销毁本地或远程快照。

选项

  • false ← (默认)

  • true

disable_warnings

布尔值

在 purestorage.flashblade 1.18.0 中添加

禁用不安全证书警告

选项

  • false ← (默认)

  • true

effect

字符串

在 purestorage.flashblade 1.9.0 中添加

允许与所有选定的 _actions_ 项目匹配的 S3 请求。规则是累加的。

选项

  • "allow" ← (默认)

  • "deny"

enabled

布尔值

策略状态

选项

  • false

  • true ← (默认)

every

整数

快照之间的时间间隔(秒)

可用范围 300 - 31536000(相当于 5m 到 365d)

fb_url

字符串

FlashBlade 管理 IP 地址或主机名。

fileid_32bit

布尔值

在 purestorage.flashblade 1.9.0 中添加

文件 ID 是否为 32 位。

选项

  • false ← (默认)

  • true

filesystem

列表 / 元素=字符串

要添加到创建策略上的文件系统列表

要修改策略成员,请使用 _purestorage.flashblade.purefb_fs_ 模块

force_delete

布尔值

在 purestorage.flashblade 1.9.0 中添加

如果对象存储访问策略附加了用户,则强制删除。

警告这可能会产生不良副作用。

系统范围的策略无法删除

选项

  • false ← (默认)

  • true

full_control

字符串

在 purestorage.flashblade 1.12.0 中添加

SMB 共享主体完全控制访问权限的状态。

设置为 “” 将清除当前设置

选项

  • "allow"

  • "deny"

  • ""

ignore_enforcement

布尔值

在 purestorage.flashblade 1.9.0 中添加

某些操作和规则元素的组合,如果在规则中同时指定,则会被隐式忽略。

如果设置为true,则尝试设置这些组合的操作将失败。

如果设置为false,则允许此类操作。

选项

  • false

  • true ← (默认)

接口

列表 / 元素=字符串

在purestorage.flashblade 1.17.0中添加

指定网络访问策略规则适用的产品接口,无论其是允许还是拒绝访问。

选项

  • "management-ssh"

  • "management-rest-api"

  • "management-web-ui"

  • "snmp"

  • "local-network-superuser-password-access"

keep_for

整数

快照保留时间

可用范围 300 - 31536000(相当于 5m 到 365d)

不得少于每个

max_retention

字符串

在 purestorage.flashblade 1.19.0 中添加

WORM文件系统的最大保留期限。

1秒到100年之间。

不能小于min_retention

有效值为周 (w)、天 (d)、小时 (h)、分钟 (m) 和秒 (s)。

min_retention

字符串

在 purestorage.flashblade 1.19.0 中添加

WORM文件系统的最小保留期限。

1秒到100年之间。

不能大于max_retention

有效值为周 (w)、天 (d)、小时 (h)、分钟 (m) 和秒 (s)。

名称

字符串

策略名称

object_resources

列表 / 元素=字符串

在 purestorage.flashblade 1.9.0 中添加

存储桶名称和对象路径列表,使用通配符(*)指定存储桶中的对象;例如,bucket1, bucket1/*, bucket2, bucket2/*。

系统范围的策略规则不能删除或修改

permission

字符串

在 purestorage.flashblade 1.9.0 中添加

指定允许导出使用的读写客户端访问权限。

选项

  • "rw"

  • "ro" ← (默认)

policy_type

字符串

在 purestorage.flashblade 1.9.0 中添加

策略类型

选项

  • "snapshot" ← (默认)

  • "access"

  • "nfs"

  • "smb_share"

  • "smb_client"

  • "network"

  • "worm"

principal

字符串

在 purestorage.flashblade 1.12.0 中添加

此规则的主体用户或组及其域

read

字符串

在 purestorage.flashblade 1.12.0 中添加

SMB共享主体读取访问权限的状态。

设置为 “” 将清除当前设置

选项

  • "allow"

  • "deny"

  • ""

rename

字符串

在purestorage.flashblade 1.10.0中添加

策略的新名称

仅适用于NFS和SMB策略

列表 / 元素=字符串

要在创建时添加到策略的文件系统副本链接列表

要修改策略成员,请使用purestorage.flashblade.purefb_fs_replica模块

retention_lock

字符串

在 purestorage.flashblade 1.19.0 中添加

创建后策略属性的状态。

如果设置为locked,则策略属性的值不允许更改。

如果设置为unlocked,则策略属性的值可以更改。

允许从unlocked更改为locked,但从locked更改为unlocked需要Pure Storage技术支持部门的支持。

选项

  • "locked"

  • "unlocked"

rule

字符串

在 purestorage.flashblade 1.9.0 中添加

对象存储访问策略的规则名称

系统范围策略中的规则不能删除或修改

s3_delimiters

列表 / 元素=字符串

在 purestorage.flashblade 1.9.0 中添加

对象列表请求中允许的分隔符列表。

授予权限以列出“文件夹名称”(以分隔符结尾的前缀),而不是对象键。

系统范围的策略规则不能删除或修改

s3_prefixes

列表 / 元素=字符串

在 purestorage.flashblade 1.9.0 中添加

可以请求对象列表的“文件夹”(对象键前缀)列表。

系统范围的策略规则不能删除或修改

secure

布尔值

在 purestorage.flashblade 1.9.0 中添加

如果为true,则阻止来自非保留端口的客户端连接访问NFS。

如果为false,则允许来自非保留端口的客户端连接访问NFS。

适用于NFSv3、NFSv4.1和辅助协议MOUNT和NLM。

选项

  • false ← (默认)

  • true

security

列表 / 元素=字符串

在 purestorage.flashblade 1.9.0 中添加

用于访问此挂载点上文件的安全模式。

如果服务器不支持请求的模式,则挂载操作将失败。

sys信任客户端指定用户身份。

krb在每个RPC请求中提供用户身份的加密证明。

krb5i为krb5添加完整性检查,以确保数据未被篡改。

krb5p为krb5添加完整性检查和加密。

选项

  • "sys" ← (默认)

  • "krb5"

  • "krb5i"

  • "krb5p"

默认: ["sys"]

smb_encryption

字符串

在 purestorage.flashblade 1.12.0 中添加

客户端策略规则中SMB加密的状态

选项

  • "disabled"

  • "optional" ← (默认)

  • "required"

source_ips

列表 / 元素=字符串

在 purestorage.flashblade 1.9.0 中添加

此规则应允许请求的IP和子网列表;例如,10.20.30.40, 10.20.30.0/24, 2001:DB8:1234:5678::/64。

系统范围的策略规则不能删除或修改

state

字符串

创建或删除策略。

复制仅适用于对象存储访问策略规则

选项

  • "absent"

  • "present" ← (默认)

  • "copy"

target

字符串

在 purestorage.flashblade 1.9.0 中添加

要将规则复制到的策略名称

target_rule

字符串

在 purestorage.flashblade 1.9.0 中添加

要将现有规则复制到的规则名称。

如果未定义,则使用现有规则名称。

timezone

字符串

at参数使用的时区

如果未提供,模块将尝试从服务器获取当前本地时区

user

字符串

在 purestorage.flashblade 1.9.0 中添加

授予策略的account中的用户。

注释

注意

  • 此模块需要purity_fb Python库

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

示例

- name: Create a simple snapshot policy with no rules
  purestorage.flashblade.purefb_policy:
    name: test_policy
    policy_type: snapshot
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create a snapshot policy and connect to existing filesystems and filesystem replica links
  purestorage.flashblade.purefb_policy:
    name: test_policy_with_members
    policy_type: snapshot
    filesystem:
    - fs1
    - fs2
    replica_link:
    - rl1
    - rl2
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create a snapshot policy with rules
  purestorage.flashblade.purefb_policy:
    name: test_policy2
    policy_type: snapshot
    at: 11AM
    keep_for: 86400
    every: 86400
    timezone: Asia/Shanghai
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Delete a snapshot policy
  purestorage.flashblade.purefb_policy:
    name: test_policy
    policy_type: snapshot
    state: absent
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create an empty object store access policy
  purestorage.flashblade.purefb_policy:
    name: test_os_policy
    account: test
    policy_type: access
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create an empty object store access policy and assign user
  purestorage.flashblade.purefb_policy:
    name: test_os_policy
    account: test
    policy_type: access
    user: fred
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create a object store access policy with simple rule
  purestorage.flashblade.purefb_policy:
    name: test_os_policy_rule
    policy_type: access
    account: test
    rule: rule1
    actions: "s3:*"
    object_resources: "*"
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create an empty SMB client policy
  purestorage.flashblade.purefb_policy:
    name: test_smb_client
    policy_type: smb_client
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create an SMB client policy with a client rule
  purestorage.flashblade.purefb_policy:
    name: test_smb_client
    policy_type: smb_client
    client: "10.0.1.0/24"
    permission: rw
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create an empty NFS export policy
  purestorage.flashblade.purefb_policy:
    name: test_nfs_export
    policy_type: nfs
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create an NFS export policy with a client rule
  purestorage.flashblade.purefb_policy:
    name: test_nfs_export
    policy_type: nfs
    atime: true
    client: "10.0.1.0/24"
    secure: true
    security: [sys, krb5]
    permission: rw
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create a new rule for an existing NFS export policy
  purestorage.flashblade.purefb_policy:
    name: test_nfs_export
    policy_type: nfs
    atime: true
    client: "10.0.2.0/24"
    security: sys
    permission: ro
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Delete a client rule from an NFS export policy
  purestorage.flashblade.purefb_policy:
    name: test_nfs_export
    client: "10.0.1.0/24"
    policy_type: nfs
    state: absent
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Delete an NFS export policy and all associated rules
  purestorage.flashblade.purefb_policy:
    name: test_nfs_export
    state: absent
    policy_type: nfs
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Delete a rule from an object store access policy
  purestorage.flashblade.purefb_policy:
    name: test_os_policy_rule
    account: test
    policy_type: access
    rule: rule1
    state: absent
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Delete a user from an object store access policy
  purestorage.flashblade.purefb_policy:
    name: test_os_policy_rule
    account: test
    user: fred
    policy_type: access
    state: absent
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Delete an object store access policy with attached users (USE WITH CAUTION)
  purestorage.flashblade.purefb_policy:
    name: test_os_policy_rule
    account: test
    policy_type: access
    force_delete: true
    state: absent
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Delete an object store access policy with no attached users
  purestorage.flashblade.purefb_policy:
    name: test_os_policy_rule
    account: test
    policy_type: access
    state: absent
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Copy an object store access policy rule to another exisitng policy
  purestorage.flashblade.purefb_policy:
    name: test_os_policy_rule
    policy_type: access
    account: test
    target: "account2/anotherpolicy"
    target_rule: new_rule1
    state: copy
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Rename an NFS Export Policy
  purestorage.flashblade.purefb_policy:
    name: old_name
    policy_type: nfs
    rename: new_name
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6
- name: Create a WORM Data Policy
  purestorage.flashblade.purefb_policy:
    name: worm1
    policy_type: worm
    default_retention: 5d
    min_rentetion: 20h
    max_retention: 1y
    fb_url: 10.10.10.2
    api_token: T-9f276a18-50ab-446e-8a0c-666a3529a1b6

作者

  • Pure Storage Ansible团队 (@sdodsley)