community.general.zfs_facts 模块 – 收集关于 ZFS 数据集的事实

注意

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

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

要安装它,请使用:ansible-galaxy collection install community.general

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

概要

  • 从 ZFS 数据集属性收集事实。

参数

参数

注释

depth

整数

指定递归深度。

默认值: 0

name

别名:ds,dataset

字符串 / 必需

ZFS 数据集名称。

parsable

布尔值

指定是否应以机器友好的格式显示属性值。

选择

  • false ←(默认)

  • true

properties

字符串

指定应以逗号分隔的格式查询哪些数据集属性。有关数据集属性的更多信息,请查看 zfs(1M) 手册页。

默认值: "all"

recurse

布尔值

指定是否应递归显示任何子项的属性。

选择

  • false ←(默认)

  • true

type

字符串

指定要显示的数据集类型。多个值必须以逗号分隔的形式提供。

选择

  • "all" ←(默认)

  • "filesystem"

  • "volume"

  • "snapshot"

  • "bookmark"

属性

属性

支持

描述

check_mode

支持: 完全

此操作不会修改状态。

可以在 check_mode 中运行并返回更改的状态预测,而无需修改目标。

diff_mode

支持: 不适用

此操作不会修改状态。

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

facts

支持: 完全

操作返回一个 ansible_facts 字典,该字典将更新现有的主机事实。

示例

- name: Gather facts about ZFS dataset rpool/export/home
  community.general.zfs_facts:
    dataset: rpool/export/home

- name: Report space usage on ZFS filesystems under data/home
  community.general.zfs_facts:
    name: data/home
    recurse: true
    type: filesystem

- ansible.builtin.debug:
    msg: 'ZFS dataset {{ item.name }} consumes {{ item.used }} of disk space.'
  with_items: '{{ ansible_zfs_datasets }}'

返回值

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

描述

name

字符串

ZFS 数据集名称

返回: 始终

示例: "rpool/var/spool"

parsable

布尔值

如果应以机器友好的格式提供可解析的输出。

返回: 如果“parsable”设置为 True

示例: true

recurse

布尔值

如果我们应该递归遍历 ZFS 数据集

返回: 如果“recurse”设置为 True

示例: true

zfs_datasets

字符串

ZFS 数据集事实

返回: 始终

示例: "{'aclinherit': 'restricted', 'aclmode': 'discard', 'atime': 'on', 'available': '43.8G', 'canmount': 'on', 'casesensitivity': 'sensitive', 'checksum': 'on', 'compression': 'off', 'compressratio': '1.00x', 'copies': '1', 'creation': 'Thu Jun 16 11:37 2016', 'dedup': 'off', 'devices': 'on', 'exec': 'on', 'filesystem_count': 'none', 'filesystem_limit': 'none', 'logbias': 'latency', 'logicalreferenced': '18.5K', 'logicalused': '3.45G', 'mlslabel': 'none', 'mounted': 'yes', 'mountpoint': '/rpool', 'name': 'rpool', 'nbmand': 'off', 'normalization': 'none', 'org.openindiana.caiman:install': 'ready', 'primarycache': 'all', 'quota': 'none', 'readonly': 'off', 'recordsize': '128K', 'redundant_metadata': 'all', 'refcompressratio': '1.00x', 'referenced': '29.5K', 'refquota': 'none', 'refreservation': 'none', 'reservation': 'none', 'secondarycache': 'all', 'setuid': 'on', 'sharenfs': 'off', 'sharesmb': 'off', 'snapdir': 'hidden', 'snapshot_count': 'none', 'snapshot_limit': 'none', 'sync': 'standard', 'type': 'filesystem', 'used': '4.41G', 'usedbychildren': '4.41G', 'usedbydataset': '29.5K', 'usedbyrefreservation': '0', 'usedbysnapshots': '0', 'utf8only': 'off', 'version': '5', 'vscan': 'off', 'written': '29.5K', 'xattr': 'on', 'zoned': 'off'}"

作者

  • Adam Števko (@xen0l)