community.general.zfs_delegate_admin 模块 – 管理 ZFS 委派管理(用户管理权限)

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

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

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

要在 playbook 中使用它,请指定:community.general.zfs_delegate_admin

概要

  • 管理 ZFS 文件系统委派管理权限,允许非特权用户执行通常仅限于超级用户的 ZFS 操作。

  • 有关选项的详细说明,请参阅 zfs(1M)zfs allow 部分。

  • 此模块尝试尽可能地遵守命令行工具的行为。

要求

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

  • 支持使用 zfs allow 进行委派的 ZFS/OpenZFS 实现,包括:Solaris >= 10、illumos(所有版本)、FreeBSD >= 8.0R、Linux 上的 ZFS >= 0.7.0。

参数

参数

注释

descendents

布尔值

将权限应用于 name 的后代(zfs allow -d)。

选择

  • false

  • true

everyone

布尔值

将权限应用于所有人。

选择

  • false ←(默认)

  • true

groups

列表 / 元素=字符串

应向其授予权限的组列表。

local

布尔值

在本地将权限应用于 namezfs allow -l)。

选择

  • false

  • true

name

字符串 / 必需

文件系统或卷名称,例如 rpool/myfs

permissions

列表 / 元素=字符串

要委派的权限列表(如果 state=present,则为必需)。

支持的权限取决于所使用的 ZFS 版本。 例如,请参阅 https://openzfs.github.io/openzfs-docs/man/8/zfs-allow.8.html OpenZFS。

recursive

布尔值

递归取消权限(当 state=present 时忽略)。

选择

  • false ←(默认)

  • true

state

字符串

是允许(present)还是取消允许(absent)权限。

当设置为 present 时,至少需要 usersgroupseveryone 的一个 “实体” 参数。

当设置为 absent 时,将从指定的实体中删除权限,如果未指定实体参数,则删除所有权限。

选择

  • "不存在"

  • "存在" ← (默认)

用户

列表 / 元素=字符串

应授予权限的用户的列表。

属性

属性

支持

描述

check_mode

支持:

可以在 check_mode 中运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持:

当处于差异模式时,将返回已更改内容(或可能需要在 check_mode 中更改的内容)的详细信息。

示例

- name: Grant `zfs allow` and `unallow` permission to the `adm` user with the default local+descendents scope
  community.general.zfs_delegate_admin:
    name: rpool/myfs
    users: adm
    permissions: allow,unallow

- name: Grant `zfs send` to everyone, plus the group `backup`
  community.general.zfs_delegate_admin:
    name: rpool/myvol
    groups: backup
    everyone: true
    permissions: send

- name: Grant `zfs send,receive` to users `foo` and `bar` with local scope only
  community.general.zfs_delegate_admin:
    name: rpool/myfs
    users: foo,bar
    permissions: send,receive
    local: true

- name: Revoke all permissions from everyone (permissions specifically assigned to users and groups remain)
  community.general.zfs_delegate_admin:
    name: rpool/myfs
    everyone: true
    state: absent

作者

  • Nate Coraor (@natefoo)