Adjust YAML in plugin docs (#10234)

* Adjust YAML in plugin docs.

* Update ignore.txt.

* Forgot two indents.

* adjust connection plugins
adjust filter plugins
adjust inventory plugins
adjust lookup plugins

* Re-add YAML document start.

---------

Co-authored-by: Alexei Znamensky <russoz@gmail.com>
This commit is contained in:
Felix Fontein 2025-06-16 17:46:01 +02:00 committed by GitHub
commit d032de3b16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 903 additions and 859 deletions

View file

@ -6,18 +6,18 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: a_module
short_description: Test whether a given string refers to an existing module or action plugin
version_added: 4.0.0
author: Felix Fontein (@felixfontein)
description:
- Test whether a given string refers to an existing module or action plugin.
- This can be useful in roles, which can use this to ensure that required modules are present ahead of time.
options:
_input:
description: A string denoting a fully qualified collection name (FQCN) of a module or action plugin.
type: string
required: true
name: a_module
short_description: Test whether a given string refers to an existing module or action plugin
version_added: 4.0.0
author: Felix Fontein (@felixfontein)
description:
- Test whether a given string refers to an existing module or action plugin.
- This can be useful in roles, which can use this to ensure that required modules are present ahead of time.
options:
_input:
description: A string denoting a fully qualified collection name (FQCN) of a module or action plugin.
type: string
required: true
'''
EXAMPLES = '''
@ -34,9 +34,9 @@ EXAMPLES = '''
'''
RETURN = '''
_value:
description: Whether the module or action plugin denoted by the input exists.
type: boolean
_value:
description: Whether the module or action plugin denoted by the input exists.
type: boolean
'''
from ansible.plugins.loader import action_loader, module_loader

View file

@ -6,31 +6,31 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: ansible_type
short_description: Validate input type
version_added: "9.2.0"
author: Vladimir Botka (@vbotka)
description: This test validates input type.
options:
_input:
description: Input data.
type: raw
required: true
dtype:
description: A single data type, or a data types list to be validated.
type: raw
required: true
alias:
description: Data type aliases.
default: {}
type: dictionary
name: ansible_type
short_description: Validate input type
version_added: "9.2.0"
author: Vladimir Botka (@vbotka)
description: This test validates input type.
options:
_input:
description: Input data.
type: raw
required: true
dtype:
description: A single data type, or a data types list to be validated.
type: raw
required: true
alias:
description: Data type aliases.
default: {}
type: dictionary
'''
EXAMPLES = '''
# Substitution converts str to AnsibleUnicode or _AnsibleTaggedStr
# ----------------------------------------------------------------
---
# String. AnsibleUnicode or _AnsibleTaggedStr.
dtype:
- AnsibleUnicode
@ -39,6 +39,7 @@ data: "abc"
result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true
---
# String. AnsibleUnicode/_AnsibleTaggedStr alias str.
alias: {"AnsibleUnicode": "str", "_AnsibleTaggedStr": "str"}
dtype: str
@ -46,6 +47,7 @@ data: "abc"
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true
---
# List. All items are AnsibleUnicode/_AnsibleTaggedStr.
dtype:
- list[AnsibleUnicode]
@ -54,6 +56,7 @@ data: ["a", "b", "c"]
result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true
---
# Dictionary. All keys and values are AnsibleUnicode/_AnsibleTaggedStr.
dtype:
- dict[AnsibleUnicode, AnsibleUnicode]
@ -65,41 +68,49 @@ result: '{{ data is community.general.ansible_type(dtype) }}'
# No substitution and no alias. Type of strings is str
# ----------------------------------------------------
---
# String
dtype: str
result: '{{ "abc" is community.general.ansible_type(dtype) }}'
# result => true
---
# Integer
dtype: int
result: '{{ 123 is community.general.ansible_type(dtype) }}'
# result => true
---
# Float
dtype: float
result: '{{ 123.45 is community.general.ansible_type(dtype) }}'
# result => true
---
# Boolean
dtype: bool
result: '{{ true is community.general.ansible_type(dtype) }}'
# result => true
---
# List. All items are strings.
dtype: list[str]
result: '{{ ["a", "b", "c"] is community.general.ansible_type(dtype) }}'
# result => true
---
# List of dictionaries.
dtype: list[dict]
result: '{{ [{"a": 1}, {"b": 2}] is community.general.ansible_type(dtype) }}'
# result => true
---
# Dictionary. All keys are strings. All values are integers.
dtype: dict[str, int]
result: '{{ {"a": 1} is community.general.ansible_type(dtype) }}'
# result => true
---
# Dictionary. All keys are strings. All values are integers.
dtype: dict[str, int]
result: '{{ {"a": 1, "b": 2} is community.general.ansible_type(dtype) }}'
@ -108,6 +119,7 @@ result: '{{ {"a": 1, "b": 2} is community.general.ansible_type(dtype) }}'
# Type of strings is AnsibleUnicode, _AnsibleTaggedStr, or str
# ------------------------------------------------------------
---
# Dictionary. The keys are integers or strings. All values are strings.
alias:
AnsibleUnicode: str
@ -118,6 +130,7 @@ data: {1: 'a', 'b': 'b'}
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true
---
# Dictionary. All keys are integers. All values are keys.
alias:
AnsibleUnicode: str
@ -128,6 +141,7 @@ data: {1: 'a', 2: 'b'}
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true
---
# Dictionary. All keys are strings. Multiple types values.
alias:
AnsibleUnicode: str
@ -135,10 +149,11 @@ alias:
_AnsibleTaggedInt: int
_AnsibleTaggedFloat: float
dtype: dict[str, bool|dict|float|int|list|str]
data: {'a': 1, 'b': 1.1, 'c': 'abc', 'd': True, 'e': ['x', 'y', 'z'], 'f': {'x': 1, 'y': 2}}
data: {'a': 1, 'b': 1.1, 'c': 'abc', 'd': true, 'e': ['x', 'y', 'z'], 'f': {'x': 1, 'y': 2}}
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true
---
# List. Multiple types items.
alias:
AnsibleUnicode: str
@ -146,25 +161,28 @@ alias:
_AnsibleTaggedInt: int
_AnsibleTaggedFloat: float
dtype: list[bool|dict|float|int|list|str]
data: [1, 2, 1.1, 'abc', True, ['x', 'y', 'z'], {'x': 1, 'y': 2}]
data: [1, 2, 1.1, 'abc', true, ['x', 'y', 'z'], {'x': 1, 'y': 2}]
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true
# Option dtype is list
# --------------------
---
# AnsibleUnicode, _AnsibleTaggedStr, or str
dtype: ['AnsibleUnicode', '_AnsibleTaggedStr', 'str']
data: abc
result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true
---
# float or int
dtype: ['float', 'int', "_AnsibleTaggedInt", "_AnsibleTaggedFloat"]
data: 123
result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true
---
# float or int
dtype: ['float', 'int', "_AnsibleTaggedInt", "_AnsibleTaggedFloat"]
data: 123.45
@ -174,23 +192,25 @@ result: '{{ data is community.general.ansible_type(dtype) }}'
# Multiple alias
# --------------
---
# int alias number
alias:
int: number
float: number
_AnsibleTaggedInt: number
_AnsibleTaggedFloat: float
int: number
float: number
_AnsibleTaggedInt: number
_AnsibleTaggedFloat: float
dtype: number
data: 123
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true
---
# float alias number
alias:
int: number
float: number
_AnsibleTaggedInt: number
_AnsibleTaggedFloat: float
int: number
float: number
_AnsibleTaggedInt: number
_AnsibleTaggedFloat: float
dtype: number
data: 123.45
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
@ -198,9 +218,9 @@ result: '{{ data is community.general.ansible_type(dtype, alias) }}'
'''
RETURN = '''
_value:
description: Whether the data type is valid.
type: bool
_value:
description: Whether the data type is valid.
type: bool
'''
from ansible.errors import AnsibleFilterError

View file

@ -17,41 +17,41 @@ else:
DOCUMENTATION = '''
name: fqdn_valid
short_description: Validates fully-qualified domain names against RFC 1123
version_added: 8.1.0
author: Vladimir Botka (@vbotka)
requirements:
name: fqdn_valid
short_description: Validates fully-qualified domain names against RFC 1123
version_added: 8.1.0
author: Vladimir Botka (@vbotka)
requirements:
- fqdn>=1.5.1 (PyPI)
description:
- This test validates Fully Qualified Domain Names (FQDNs)
conforming to the Internet Engineering Task Force specification
RFC 1123 and RFC 952.
- The design intent is to validate that a string would be
traditionally acceptable as a public Internet hostname to
RFC-conforming software, which is a strict subset of the logic
in modern web browsers like Mozilla Firefox and Chromium that
determines whether make a DNS lookup.
- Certificate Authorities like Let's Encrypt run a narrower set of
string validation logic to determine validity for issuance. This
test is not intended to achieve functional parity with CA
issuance.
- Single label names are allowed by default (O(min_labels=1)).
options:
_input:
description: Name of the host.
type: str
required: true
min_labels:
description: Required minimum of labels, separated by period.
default: 1
type: int
required: false
allow_underscores:
description: Allow underscore characters.
default: false
type: bool
required: false
description:
- This test validates Fully Qualified Domain Names (FQDNs)
conforming to the Internet Engineering Task Force specification
RFC 1123 and RFC 952.
- The design intent is to validate that a string would be
traditionally acceptable as a public Internet hostname to
RFC-conforming software, which is a strict subset of the logic
in modern web browsers like Mozilla Firefox and Chromium that
determines whether make a DNS lookup.
- Certificate Authorities like Let's Encrypt run a narrower set of
string validation logic to determine validity for issuance. This
test is not intended to achieve functional parity with CA
issuance.
- Single label names are allowed by default (O(min_labels=1)).
options:
_input:
description: Name of the host.
type: str
required: true
min_labels:
description: Required minimum of labels, separated by period.
default: 1
type: int
required: false
allow_underscores:
description: Allow underscore characters.
default: false
type: bool
required: false
'''
EXAMPLES = '''
@ -69,9 +69,9 @@ EXAMPLES = '''
'''
RETURN = '''
_value:
description: Whether the name is valid.
type: bool
_value:
description: Whether the name is valid.
type: bool
'''