mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-22 10:21:25 -07:00
[PR #9401/df42f29e backport][stable-10] [def]*.py: normalize docs (#9413)
[def]*.py: normalize docs (#9401)
* [def]*.py: normalize docs
* Update plugins/modules/datadog_monitor.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit df42f29e53
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
1829ad4fdc
commit
0df708b15a
30 changed files with 1300 additions and 1431 deletions
|
@ -9,17 +9,14 @@ from __future__ import absolute_import, division, print_function
|
|||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: filesize
|
||||
|
||||
short_description: Create a file with a given size, or resize it if it exists
|
||||
|
||||
description:
|
||||
- This module is a simple wrapper around C(dd) to create, extend or truncate
|
||||
a file, given its size. It can be used to manage swap files (that require
|
||||
contiguous blocks) or alternatively, huge sparse files.
|
||||
|
||||
- This module is a simple wrapper around C(dd) to create, extend or truncate a file, given its size. It can be used to manage
|
||||
swap files (that require contiguous blocks) or alternatively, huge sparse files.
|
||||
author:
|
||||
- quidame (@quidame)
|
||||
|
||||
|
@ -40,36 +37,27 @@ options:
|
|||
size:
|
||||
description:
|
||||
- Requested size of the file.
|
||||
- The value is a number (either C(int) or C(float)) optionally followed
|
||||
by a multiplicative suffix, that can be one of V(B) (bytes), V(KB) or
|
||||
V(kB) (= 1000B), V(MB) or V(mB) (= 1000kB), V(GB) or V(gB) (= 1000MB),
|
||||
and so on for V(T), V(P), V(E), V(Z) and V(Y); or alternatively one of
|
||||
V(K), V(k) or V(KiB) (= 1024B); V(M), V(m) or V(MiB) (= 1024KiB);
|
||||
- The value is a number (either C(int) or C(float)) optionally followed by a multiplicative suffix, that can be one
|
||||
of V(B) (bytes), V(KB) or V(kB) (= 1000B), V(MB) or V(mB) (= 1000kB), V(GB) or V(gB) (= 1000MB), and so on for V(T),
|
||||
V(P), V(E), V(Z) and V(Y); or alternatively one of V(K), V(k) or V(KiB) (= 1024B); V(M), V(m) or V(MiB) (= 1024KiB);
|
||||
V(G), V(g) or V(GiB) (= 1024MiB); and so on.
|
||||
- If the multiplicative suffix is not provided, the value is treated as
|
||||
an integer number of blocks of O(blocksize) bytes each (float values
|
||||
are rounded to the closest integer).
|
||||
- If the multiplicative suffix is not provided, the value is treated as an integer number of blocks of O(blocksize)
|
||||
bytes each (float values are rounded to the closest integer).
|
||||
- When the O(size) value is equal to the current file size, does nothing.
|
||||
- When the O(size) value is bigger than the current file size, bytes from
|
||||
O(source) (if O(sparse) is not V(false)) are appended to the file
|
||||
without truncating it, in other words, without modifying the existing
|
||||
bytes of the file.
|
||||
- When the O(size) value is smaller than the current file size, it is
|
||||
truncated to the requested value without modifying bytes before this
|
||||
value.
|
||||
- That means that a file of any arbitrary size can be grown to any other
|
||||
arbitrary size, and then resized down to its initial size without
|
||||
modifying its initial content.
|
||||
- When the O(size) value is bigger than the current file size, bytes from O(source) (if O(sparse) is not V(false)) are
|
||||
appended to the file without truncating it, in other words, without modifying the existing bytes of the file.
|
||||
- When the O(size) value is smaller than the current file size, it is truncated to the requested value without modifying
|
||||
bytes before this value.
|
||||
- That means that a file of any arbitrary size can be grown to any other arbitrary size, and then resized down to its
|
||||
initial size without modifying its initial content.
|
||||
type: raw
|
||||
required: true
|
||||
blocksize:
|
||||
description:
|
||||
- Size of blocks, in bytes if not followed by a multiplicative suffix.
|
||||
- The numeric value (before the unit) B(MUST) be an integer (or a C(float)
|
||||
if it equals an integer).
|
||||
- If not set, the size of blocks is guessed from the OS and commonly
|
||||
results in V(512) or V(4096) bytes, that is used internally by the
|
||||
module or when O(size) has no unit.
|
||||
- The numeric value (before the unit) B(MUST) be an integer (or a C(float) if it equals an integer).
|
||||
- If not set, the size of blocks is guessed from the OS and commonly results in V(512) or V(4096) bytes, that is used
|
||||
internally by the module or when O(size) has no unit.
|
||||
type: raw
|
||||
source:
|
||||
description:
|
||||
|
@ -79,26 +67,22 @@ options:
|
|||
default: /dev/zero
|
||||
force:
|
||||
description:
|
||||
- Whether or not to overwrite the file if it exists, in other words, to
|
||||
truncate it from 0. When V(true), the module is not idempotent, that
|
||||
means it always reports C(changed=true).
|
||||
- Whether or not to overwrite the file if it exists, in other words, to truncate it from 0. When V(true), the module
|
||||
is not idempotent, that means it always reports C(changed=true).
|
||||
- O(force=true) and O(sparse=true) are mutually exclusive.
|
||||
type: bool
|
||||
default: false
|
||||
sparse:
|
||||
description:
|
||||
- Whether or not the file to create should be a sparse file.
|
||||
- This option is effective only on newly created files, or when growing a
|
||||
file, only for the bytes to append.
|
||||
- This option is effective only on newly created files, or when growing a file, only for the bytes to append.
|
||||
- This option is not supported on OSes or filesystems not supporting sparse files.
|
||||
- O(force=true) and O(sparse=true) are mutually exclusive.
|
||||
type: bool
|
||||
default: false
|
||||
unsafe_writes:
|
||||
description:
|
||||
- This option is silently ignored. This module always modifies file
|
||||
size in-place.
|
||||
|
||||
- This option is silently ignored. This module always modifies file size in-place.
|
||||
requirements:
|
||||
- dd (Data Duplicator) in PATH
|
||||
|
||||
|
@ -138,9 +122,9 @@ seealso:
|
|||
- name: busybox(1) manpage for Linux
|
||||
description: Manual page of the GNU/Linux's busybox, that provides its own dd implementation.
|
||||
link: https://www.unix.com/man-page/linux/1/busybox
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = r'''
|
||||
EXAMPLES = r"""
|
||||
- name: Create a file of 1G filled with null bytes
|
||||
community.general.filesize:
|
||||
path: /var/bigfile
|
||||
|
@ -183,9 +167,9 @@ EXAMPLES = r'''
|
|||
mode: u=rw,go=
|
||||
owner: root
|
||||
group: root
|
||||
'''
|
||||
"""
|
||||
|
||||
RETURN = r'''
|
||||
RETURN = r"""
|
||||
cmd:
|
||||
description: Command executed to create or resize the file.
|
||||
type: str
|
||||
|
@ -229,7 +213,7 @@ path:
|
|||
type: str
|
||||
sample: /var/swap0
|
||||
returned: always
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
import re
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue