z mods adjust docs (#9306)

z* modules: adjust docs (re-commiting with adjustment from PR)
This commit is contained in:
Alexei Znamensky 2024-12-23 21:40:39 +13:00 committed by GitHub
parent e809a25486
commit d05d067f3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 128 additions and 216 deletions

View file

@ -9,8 +9,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: zpool_facts
short_description: Gather facts about ZFS pools
description:
@ -21,29 +20,28 @@ extends_documentation_fragment:
- community.general.attributes.facts
- community.general.attributes.facts_module
options:
name:
description:
- ZFS pool name.
type: str
aliases: [ "pool", "zpool" ]
required: false
parsable:
description:
- Specifies if property values should be displayed in machine
friendly format.
type: bool
default: false
required: false
properties:
description:
- Specifies which dataset properties should be queried in comma-separated format.
For more information about dataset properties, check zpool(1M) man page.
type: str
default: all
required: false
'''
name:
description:
- ZFS pool name.
type: str
aliases: ["pool", "zpool"]
required: false
parsable:
description:
- Specifies if property values should be displayed in machine friendly format.
type: bool
default: false
required: false
properties:
description:
- Specifies which dataset properties should be queried in comma-separated format. For more information about dataset properties, check zpool(1M)
man page.
type: str
default: all
required: false
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Gather facts about ZFS pool rpool
community.general.zpool_facts: pool=rpool
@ -54,71 +52,37 @@ EXAMPLES = '''
ansible.builtin.debug:
msg: 'ZFS pool {{ item.name }} has {{ item.free }} free space out of {{ item.size }}.'
with_items: '{{ ansible_zfs_pools }}'
'''
"""
RETURN = '''
RETURN = r"""
ansible_facts:
description: Dictionary containing all the detailed information about the ZFS pool facts
returned: always
type: complex
contains:
ansible_zfs_pools:
description: ZFS pool facts
returned: always
type: str
sample:
{
"allocated": "3.46G",
"altroot": "-",
"autoexpand": "off",
"autoreplace": "off",
"bootfs": "rpool/ROOT/openindiana",
"cachefile": "-",
"capacity": "6%",
"comment": "-",
"dedupditto": "0",
"dedupratio": "1.00x",
"delegation": "on",
"expandsize": "-",
"failmode": "wait",
"feature@async_destroy": "enabled",
"feature@bookmarks": "enabled",
"feature@edonr": "enabled",
"feature@embedded_data": "active",
"feature@empty_bpobj": "active",
"feature@enabled_txg": "active",
"feature@extensible_dataset": "enabled",
"feature@filesystem_limits": "enabled",
"feature@hole_birth": "active",
"feature@large_blocks": "enabled",
"feature@lz4_compress": "active",
"feature@multi_vdev_crash_dump": "enabled",
"feature@sha512": "enabled",
"feature@skein": "enabled",
"feature@spacemap_histogram": "active",
"fragmentation": "3%",
"free": "46.3G",
"freeing": "0",
"guid": "15729052870819522408",
"health": "ONLINE",
"leaked": "0",
"listsnapshots": "off",
"name": "rpool",
"readonly": "off",
"size": "49.8G",
"version": "-"
}
description: Dictionary containing all the detailed information about the ZFS pool facts.
returned: always
type: complex
contains:
ansible_zfs_pools:
description: ZFS pool facts.
returned: always
type: str
sample: {"allocated": "3.46G", "altroot": "-", "autoexpand": "off", "autoreplace": "off", "bootfs": "rpool/ROOT/openindiana", "cachefile": "-",
"capacity": "6%", "comment": "-", "dedupditto": "0", "dedupratio": "1.00x", "delegation": "on", "expandsize": "-", "failmode": "wait",
"feature@async_destroy": "enabled", "feature@bookmarks": "enabled", "feature@edonr": "enabled", "feature@embedded_data": "active",
"feature@empty_bpobj": "active", "feature@enabled_txg": "active", "feature@extensible_dataset": "enabled", "feature@filesystem_limits": "enabled",
"feature@hole_birth": "active", "feature@large_blocks": "enabled", "feature@lz4_compress": "active", "feature@multi_vdev_crash_dump": "enabled",
"feature@sha512": "enabled", "feature@skein": "enabled", "feature@spacemap_histogram": "active", "fragmentation": "3%", "free": "46.3G",
"freeing": "0", "guid": "15729052870819522408", "health": "ONLINE", "leaked": "0", "listsnapshots": "off", "name": "rpool", "readonly": "off",
"size": "49.8G", "version": "-"}
name:
description: ZFS pool name
returned: always
type: str
sample: rpool
description: ZFS pool name.
returned: always
type: str
sample: rpool
parsable:
description: if parsable output should be provided in machine friendly format.
returned: if 'parsable' is set to True
type: bool
sample: true
'''
description: If parsable output should be provided in machine friendly format.
returned: if O(parsable=true)
type: bool
sample: true
"""
from collections import defaultdict