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
parent e8f965fbf8
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

@ -99,7 +99,7 @@ options:
section: paramiko_connection section: paramiko_connection
type: boolean type: boolean
look_for_keys: look_for_keys:
default: True default: true
description: "Set to V(false) to disable searching for private key files in C(~/.ssh/)." description: "Set to V(false) to disable searching for private key files in C(~/.ssh/)."
env: env:
- name: ANSIBLE_PARAMIKO_LOOK_FOR_KEYS - name: ANSIBLE_PARAMIKO_LOOK_FOR_KEYS
@ -119,7 +119,7 @@ options:
vars: vars:
- name: ansible_paramiko_proxy_command - name: ansible_paramiko_proxy_command
record_host_keys: record_host_keys:
default: True default: true
description: "Save the host keys to a file." description: "Save the host keys to a file."
env: env:
- name: ANSIBLE_PARAMIKO_RECORD_HOST_KEYS - name: ANSIBLE_PARAMIKO_RECORD_HOST_KEYS
@ -147,7 +147,7 @@ options:
use_persistent_connections: use_persistent_connections:
description: "Toggles the use of persistence for connections." description: "Toggles the use of persistence for connections."
type: boolean type: boolean
default: False default: false
env: env:
- name: ANSIBLE_USE_PERSISTENT_CONNECTIONS - name: ANSIBLE_USE_PERSISTENT_CONNECTIONS
ini: ini:

View file

@ -5,7 +5,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: to_prettytable name: to_prettytable
short_description: Format a list of dictionaries as an ASCII table short_description: Format a list of dictionaries as an ASCII table
version_added: "10.7.0" version_added: "10.7.0"
@ -37,9 +37,9 @@ options:
For example, V({'name': 'left', 'id': 'right'}) will align the C(name) column to the left For example, V({'name': 'left', 'id': 'right'}) will align the C(name) column to the left
and the C(id) column to the right. and the C(id) column to the right.
type: dictionary type: dictionary
''' """
EXAMPLES = ''' EXAMPLES = r"""
--- ---
- name: Set a list of users - name: Set a list of users
ansible.builtin.set_fact: ansible.builtin.set_fact:
@ -104,13 +104,13 @@ EXAMPLES = '''
column_alignments={'name': 'center', 'age': 'right', 'role': 'left'} column_alignments={'name': 'center', 'age': 'right', 'role': 'left'}
) )
}} }}
''' """
RETURN = ''' RETURN = r"""
_value: _value:
description: The formatted ASCII table. description: The formatted ASCII table.
type: string type: string
''' """
try: try:
import prettytable import prettytable

View file

@ -5,24 +5,24 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = ''' DOCUMENTATION = r"""
author: Orion Poplawski (@opoplawski) author: Orion Poplawski (@opoplawski)
name: cobbler name: cobbler
short_description: Cobbler inventory source short_description: Cobbler inventory source
version_added: 1.0.0 version_added: 1.0.0
description: description:
- Get inventory hosts from the cobbler service. - Get inventory hosts from the cobbler service.
- "Uses a configuration file as an inventory source, it must end in C(.cobbler.yml) or C(.cobbler.yaml) and have a C(plugin: cobbler) entry." - "Uses a configuration file as an inventory source, it must end in C(.cobbler.yml) or C(.cobbler.yaml) and have a C(plugin: cobbler) entry."
- Adds the primary IP addresses to C(cobbler_ipv4_address) and C(cobbler_ipv6_address) host variables if defined in Cobbler. The primary IP address is - Adds the primary IP addresses to C(cobbler_ipv4_address) and C(cobbler_ipv6_address) host variables if defined in Cobbler. The primary IP address is
defined as the management interface if defined, or the interface who's DNS name matches the hostname of the system, or else the first interface found. defined as the management interface if defined, or the interface who's DNS name matches the hostname of the system, or else the first interface found.
extends_documentation_fragment: extends_documentation_fragment:
- inventory_cache - inventory_cache
options: options:
plugin: plugin:
description: The name of this plugin, it should always be set to V(community.general.cobbler) for this plugin to recognize it as its own. description: The name of this plugin, it should always be set to V(community.general.cobbler) for this plugin to recognize it as its own.
type: string type: string
required: true required: true
choices: [ 'cobbler', 'community.general.cobbler' ] choices: ['cobbler', 'community.general.cobbler']
url: url:
description: URL to cobbler. description: URL to cobbler.
type: string type: string
@ -84,14 +84,14 @@ DOCUMENTATION = '''
- By default the networking hostname is used if defined, otherwise the DNS name of the management or first non-static interface. - By default the networking hostname is used if defined, otherwise the DNS name of the management or first non-static interface.
- If set to V(system), the cobbler system name is used. - If set to V(system), the cobbler system name is used.
type: str type: str
choices: [ 'hostname', 'system' ] choices: ['hostname', 'system']
default: hostname default: hostname
version_added: 7.1.0 version_added: 7.1.0
group_by: group_by:
description: Keys to group hosts by. description: Keys to group hosts by.
type: list type: list
elements: string elements: string
default: [ 'mgmt_classes', 'owners', 'status' ] default: ['mgmt_classes', 'owners', 'status']
group: group:
description: Group to place all hosts into. description: Group to place all hosts into.
default: cobbler default: cobbler
@ -114,18 +114,18 @@ DOCUMENTATION = '''
- "Set to V(normal) to gather only system-level variables." - "Set to V(normal) to gather only system-level variables."
- "Set to V(as_rendered) to gather all variables as rolled up by Cobbler." - "Set to V(as_rendered) to gather all variables as rolled up by Cobbler."
type: string type: string
choices: [ 'normal', 'as_rendered' ] choices: ['normal', 'as_rendered']
default: normal default: normal
version_added: 10.7.0 version_added: 10.7.0
''' """
EXAMPLES = ''' EXAMPLES = r"""
# my.cobbler.yml # my.cobbler.yml
plugin: community.general.cobbler plugin: community.general.cobbler
url: http://cobbler/cobbler_api url: http://cobbler/cobbler_api
user: ansible-tester user: ansible-tester
password: secure password: secure
''' """
import socket import socket

View file

@ -7,19 +7,19 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: gitlab_runners name: gitlab_runners
author: author:
- Stefan Heitmüller (@morph027) <stefan.heitmueller@gmx.com> - Stefan Heitmüller (@morph027) <stefan.heitmueller@gmx.com>
short_description: Ansible dynamic inventory plugin for GitLab runners. short_description: Ansible dynamic inventory plugin for GitLab runners.
requirements: requirements:
- python-gitlab > 1.8.0 - python-gitlab > 1.8.0
extends_documentation_fragment: extends_documentation_fragment:
- constructed - constructed
description: description:
- Reads inventories from the GitLab API. - Reads inventories from the GitLab API.
- Uses a YAML configuration file gitlab_runners.[yml|yaml]. - Uses a YAML configuration file gitlab_runners.[yml|yaml].
options: options:
plugin: plugin:
description: The name of this plugin, it should always be set to 'gitlab_runners' for this plugin to recognize it as its own. description: The name of this plugin, it should always be set to 'gitlab_runners' for this plugin to recognize it as its own.
type: str type: str
@ -54,9 +54,9 @@ DOCUMENTATION = '''
description: Toggle to (not) include all available nodes metadata description: Toggle to (not) include all available nodes metadata
type: bool type: bool
default: true default: true
''' """
EXAMPLES = ''' EXAMPLES = r"""
--- ---
# gitlab_runners.yml # gitlab_runners.yml
plugin: community.general.gitlab_runners plugin: community.general.gitlab_runners
@ -79,7 +79,7 @@ keyed_groups:
# hint: labels containing special characters will be converted to safe names # hint: labels containing special characters will be converted to safe names
- key: 'tag_list' - key: 'tag_list'
prefix: tag prefix: tag
''' """
from ansible.errors import AnsibleError, AnsibleParserError from ansible.errors import AnsibleError, AnsibleParserError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable from ansible.plugins.inventory import BaseInventoryPlugin, Constructable

View file

@ -6,19 +6,19 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: icinga2 name: icinga2
short_description: Icinga2 inventory source short_description: Icinga2 inventory source
version_added: 3.7.0 version_added: 3.7.0
author: author:
- Cliff Hults (@BongoEADGC6) <cliff.hults@gmail.com> - Cliff Hults (@BongoEADGC6) <cliff.hults@gmail.com>
description: description:
- Get inventory hosts from the Icinga2 API. - Get inventory hosts from the Icinga2 API.
- "Uses a configuration file as an inventory source, it must end in - "Uses a configuration file as an inventory source, it must end in
C(.icinga2.yml) or C(.icinga2.yaml)." C(.icinga2.yml) or C(.icinga2.yaml)."
extends_documentation_fragment: extends_documentation_fragment:
- constructed - constructed
options: options:
strict: strict:
version_added: 4.4.0 version_added: 4.4.0
compose: compose:
@ -68,9 +68,9 @@ DOCUMENTATION = '''
type: boolean type: boolean
default: true default: true
version_added: 8.4.0 version_added: 8.4.0
''' """
EXAMPLES = r''' EXAMPLES = r"""
# my.icinga2.yml # my.icinga2.yml
plugin: community.general.icinga2 plugin: community.general.icinga2
url: http://localhost:5665 url: http://localhost:5665
@ -93,7 +93,7 @@ compose:
# set 'ansible_user' and 'ansible_port' from icinga2 host vars # set 'ansible_user' and 'ansible_port' from icinga2 host vars
ansible_user: icinga2_attributes.vars.ansible_user ansible_user: icinga2_attributes.vars.ansible_user
ansible_port: icinga2_attributes.vars.ansible_port | default(22) ansible_port: icinga2_attributes.vars.ansible_port | default(22)
''' """
import json import json

View file

@ -6,7 +6,7 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = r''' DOCUMENTATION = r"""
name: iocage name: iocage
short_description: iocage inventory source short_description: iocage inventory source
version_added: 10.2.0 version_added: 10.2.0
@ -110,9 +110,9 @@ notes:
expects to find the O(hooks_results) items in the path expects to find the O(hooks_results) items in the path
C(/iocage/iocage/jails/<name>/root). If you mount the C(poolname) to a C(/iocage/iocage/jails/<name>/root). If you mount the C(poolname) to a
different path the easiest remedy is to create a symlink. different path the easiest remedy is to create a symlink.
''' """
EXAMPLES = r''' EXAMPLES = r"""
--- ---
# file name must end with iocage.yaml or iocage.yml # file name must end with iocage.yaml or iocage.yml
plugin: community.general.iocage plugin: community.general.iocage
@ -182,7 +182,7 @@ compose:
ansible_host: iocage_hooks.0 ansible_host: iocage_hooks.0
groups: groups:
test: inventory_hostname.startswith('test') test: inventory_hostname.startswith('test')
''' """
import re import re
import os import os

View file

@ -5,23 +5,23 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = r''' DOCUMENTATION = r"""
name: linode name: linode
author: author:
- Luke Murphy (@decentral1se) - Luke Murphy (@decentral1se)
short_description: Ansible dynamic inventory plugin for Linode. short_description: Ansible dynamic inventory plugin for Linode.
requirements: requirements:
- linode_api4 >= 2.0.0 - linode_api4 >= 2.0.0
description: description:
- Reads inventories from the Linode API v4. - Reads inventories from the Linode API v4.
- Uses a YAML configuration file that ends with linode.(yml|yaml). - Uses a YAML configuration file that ends with linode.(yml|yaml).
- Linode labels are used by default as the hostnames. - Linode labels are used by default as the hostnames.
- The default inventory groups are built from groups (deprecated by - The default inventory groups are built from groups (deprecated by
Linode) and not tags. Linode) and not tags.
extends_documentation_fragment: extends_documentation_fragment:
- constructed - constructed
- inventory_cache - inventory_cache
options: options:
cache: cache:
version_added: 4.5.0 version_added: 4.5.0
cache_plugin: cache_plugin:
@ -75,9 +75,9 @@ DOCUMENTATION = r'''
version_added: 2.0.0 version_added: 2.0.0
keyed_groups: keyed_groups:
version_added: 2.0.0 version_added: 2.0.0
''' """
EXAMPLES = r''' EXAMPLES = r"""
--- ---
# Minimal example. `LINODE_ACCESS_TOKEN` is exposed in environment. # Minimal example. `LINODE_ACCESS_TOKEN` is exposed in environment.
plugin: community.general.linode plugin: community.general.linode
@ -124,7 +124,7 @@ access_token: foobar
ip_style: api ip_style: api
compose: compose:
ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first" ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first"
''' """
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable

View file

@ -5,23 +5,23 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = r''' DOCUMENTATION = r"""
name: lxd name: lxd
short_description: Returns Ansible inventory from lxd host short_description: Returns Ansible inventory from lxd host
description: description:
- Get inventory from the lxd. - Get inventory from the lxd.
- Uses a YAML configuration file that ends with 'lxd.(yml|yaml)'. - Uses a YAML configuration file that ends with 'lxd.(yml|yaml)'.
version_added: "3.0.0" version_added: "3.0.0"
author: "Frank Dornheim (@conloos)" author: "Frank Dornheim (@conloos)"
requirements: requirements:
- ipaddress - ipaddress
- lxd >= 4.0 - lxd >= 4.0
options: options:
plugin: plugin:
description: Token that ensures this is a source file for the 'lxd' plugin. description: Token that ensures this is a source file for the 'lxd' plugin.
type: string type: string
required: true required: true
choices: [ 'community.general.lxd' ] choices: ['community.general.lxd']
url: url:
description: description:
- The unix domain socket path or the https URL for the lxd server. - The unix domain socket path or the https URL for the lxd server.
@ -32,13 +32,13 @@ DOCUMENTATION = r'''
client_key: client_key:
description: description:
- The client certificate key file path. - The client certificate key file path.
aliases: [ key_file ] aliases: [key_file]
default: $HOME/.config/lxc/client.key default: $HOME/.config/lxc/client.key
type: path type: path
client_cert: client_cert:
description: description:
- The client certificate file path. - The client certificate file path.
aliases: [ cert_file ] aliases: [cert_file]
default: $HOME/.config/lxc/client.crt default: $HOME/.config/lxc/client.crt
type: path type: path
server_cert: server_cert:
@ -68,7 +68,7 @@ DOCUMENTATION = r'''
description: Filter the instance according to the current status. description: Filter the instance according to the current status.
type: str type: str
default: none default: none
choices: [ 'STOPPED', 'STARTING', 'RUNNING', 'none' ] choices: ['STOPPED', 'STARTING', 'RUNNING', 'none']
project: project:
description: Filter the instance according to the given project. description: Filter the instance according to the given project.
type: str type: str
@ -80,7 +80,7 @@ DOCUMENTATION = r'''
- The first version of the inventory only supported containers. - The first version of the inventory only supported containers.
type: str type: str
default: container default: container
choices: [ 'virtual-machine', 'container', 'both' ] choices: ['virtual-machine', 'container', 'both']
version_added: 4.2.0 version_added: 4.2.0
prefered_instance_network_interface: prefered_instance_network_interface:
description: description:
@ -98,15 +98,15 @@ DOCUMENTATION = r'''
- Specify V(inet) for IPv4 and V(inet6) for IPv6. - Specify V(inet) for IPv4 and V(inet6) for IPv6.
type: str type: str
default: inet default: inet
choices: [ 'inet', 'inet6' ] choices: ['inet', 'inet6']
groupby: groupby:
description: description:
- Create groups by the following keywords C(location), C(network_range), C(os), C(pattern), C(profile), C(release), C(type), C(vlanid). - Create groups by the following keywords C(location), C(network_range), C(os), C(pattern), C(profile), C(release), C(type), C(vlanid).
- See example for syntax. - See example for syntax.
type: dict type: dict
''' """
EXAMPLES = ''' EXAMPLES = r"""
--- ---
# simple lxd.yml # simple lxd.yml
plugin: community.general.lxd plugin: community.general.lxd
@ -165,7 +165,7 @@ groupby:
projectInternals: projectInternals:
type: project type: project
attribute: internals attribute: internals
''' """
import json import json
import re import re

View file

@ -5,18 +5,18 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = ''' DOCUMENTATION = r"""
author: Unknown (!UNKNOWN) author: Unknown (!UNKNOWN)
name: nmap name: nmap
short_description: Uses nmap to find hosts to target short_description: Uses nmap to find hosts to target
description: description:
- Uses a YAML configuration file with a valid YAML extension. - Uses a YAML configuration file with a valid YAML extension.
extends_documentation_fragment: extends_documentation_fragment:
- constructed - constructed
- inventory_cache - inventory_cache
requirements: requirements:
- nmap CLI installed - nmap CLI installed
options: options:
plugin: plugin:
description: token that ensures this is a source file for the 'nmap' plugin. description: token that ensures this is a source file for the 'nmap' plugin.
type: string type: string
@ -96,11 +96,11 @@ DOCUMENTATION = '''
type: boolean type: boolean
default: true default: true
version_added: 7.4.0 version_added: 7.4.0
notes: notes:
- At least one of O(ipv4) or O(ipv6) is required to be V(true); both can be V(true), but they cannot both be V(false). - At least one of O(ipv4) or O(ipv6) is required to be V(true); both can be V(true), but they cannot both be V(false).
- 'TODO: add OS fingerprinting' - 'TODO: add OS fingerprinting'
''' """
EXAMPLES = ''' EXAMPLES = r"""
--- ---
# inventory.config file in YAML format # inventory.config file in YAML format
plugin: community.general.nmap plugin: community.general.nmap
@ -122,7 +122,7 @@ exclude: 192.168.0.1, web.example.com
port: 22, 443 port: 22, 443
groups: groups:
web_servers: "ports | selectattr('port', 'equalto', '443')" web_servers: "ports | selectattr('port', 'equalto', '443')"
''' """
import os import os
import re import re

View file

@ -5,14 +5,14 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = r''' DOCUMENTATION = r"""
name: online name: online
author: author:
- Remy Leone (@remyleone) - Remy Leone (@remyleone)
short_description: Scaleway (previously Online SAS or Online.net) inventory source short_description: Scaleway (previously Online SAS or Online.net) inventory source
description: description:
- Get inventory hosts from Scaleway (previously Online SAS or Online.net). - Get inventory hosts from Scaleway (previously Online SAS or Online.net).
options: options:
plugin: plugin:
description: token that ensures this is a source file for the 'online' plugin. description: token that ensures this is a source file for the 'online' plugin.
type: string type: string
@ -45,9 +45,9 @@ DOCUMENTATION = r'''
- location - location
- offer - offer
- rpn - rpn
''' """
EXAMPLES = r''' EXAMPLES = r"""
# online_inventory.yml file in YAML format # online_inventory.yml file in YAML format
# Example command line: ansible-inventory --list -i online_inventory.yml # Example command line: ansible-inventory --list -i online_inventory.yml
@ -58,7 +58,7 @@ groups:
- location - location
- offer - offer
- rpn - rpn
''' """
import json import json
from sys import version as python_version from sys import version as python_version

View file

@ -6,25 +6,25 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = r''' DOCUMENTATION = r"""
name: opennebula name: opennebula
author: author:
- Kristian Feldsam (@feldsam) - Kristian Feldsam (@feldsam)
short_description: OpenNebula inventory source short_description: OpenNebula inventory source
version_added: "3.8.0" version_added: "3.8.0"
extends_documentation_fragment: extends_documentation_fragment:
- constructed - constructed
description: description:
- Get inventory hosts from OpenNebula cloud. - Get inventory hosts from OpenNebula cloud.
- Uses an YAML configuration file ending with either C(opennebula.yml) or C(opennebula.yaml) - Uses an YAML configuration file ending with either C(opennebula.yml) or C(opennebula.yaml)
to set parameter values. to set parameter values.
- Uses O(api_authfile), C(~/.one/one_auth), or E(ONE_AUTH) pointing to a OpenNebula credentials file. - Uses O(api_authfile), C(~/.one/one_auth), or E(ONE_AUTH) pointing to a OpenNebula credentials file.
options: options:
plugin: plugin:
description: Token that ensures this is a source file for the 'opennebula' plugin. description: Token that ensures this is a source file for the 'opennebula' plugin.
type: string type: string
required: true required: true
choices: [ community.general.opennebula ] choices: [community.general.opennebula]
api_url: api_url:
description: description:
- URL of the OpenNebula RPC server. - URL of the OpenNebula RPC server.
@ -74,9 +74,9 @@ DOCUMENTATION = r'''
description: Create host groups by vm labels description: Create host groups by vm labels
type: bool type: bool
default: true default: true
''' """
EXAMPLES = r''' EXAMPLES = r"""
# inventory_opennebula.yml file in YAML format # inventory_opennebula.yml file in YAML format
# Example command line: ansible-inventory --list -i inventory_opennebula.yml # Example command line: ansible-inventory --list -i inventory_opennebula.yml
@ -84,7 +84,7 @@ EXAMPLES = r'''
plugin: community.general.opennebula plugin: community.general.opennebula
api_url: https://opennebula:2633/RPC2 api_url: https://opennebula:2633/RPC2
filter_by_label: Cache filter_by_label: Cache
''' """
try: try:
import pyone import pyone

View file

@ -6,16 +6,16 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = r''' DOCUMENTATION = r"""
name: scaleway name: scaleway
author: author:
- Remy Leone (@remyleone) - Remy Leone (@remyleone)
short_description: Scaleway inventory source short_description: Scaleway inventory source
description: description:
- Get inventory hosts from Scaleway. - Get inventory hosts from Scaleway.
requirements: requirements:
- PyYAML - PyYAML
options: options:
plugin: plugin:
description: Token that ensures this is a source file for the 'scaleway' plugin. description: Token that ensures this is a source file for the 'scaleway' plugin.
required: true required: true
@ -70,9 +70,9 @@ DOCUMENTATION = r'''
L(Scaleway API, https://developer.scaleway.com/#servers-server-get) L(Scaleway API, https://developer.scaleway.com/#servers-server-get)
can be used.' can be used.'
type: dict type: dict
''' """
EXAMPLES = r''' EXAMPLES = r"""
# scaleway_inventory.yml file in YAML format # scaleway_inventory.yml file in YAML format
# Example command line: ansible-inventory --list -i scaleway_inventory.yml # Example command line: ansible-inventory --list -i scaleway_inventory.yml
@ -110,7 +110,7 @@ variables:
ansible_host: public_ip.address ansible_host: public_ip.address
ansible_connection: "'ssh'" ansible_connection: "'ssh'"
ansible_user: "'admin'" ansible_user: "'admin'"
''' """
import os import os
import json import json

View file

@ -5,20 +5,20 @@
from __future__ import annotations from __future__ import annotations
DOCUMENTATION = ''' DOCUMENTATION = r"""
author: Unknown (!UNKNOWN) author: Unknown (!UNKNOWN)
name: virtualbox name: virtualbox
short_description: virtualbox inventory source short_description: virtualbox inventory source
description: description:
- Get inventory hosts from the local virtualbox installation. - Get inventory hosts from the local virtualbox installation.
- Uses a YAML configuration file that ends with virtualbox.(yml|yaml) or vbox.(yml|yaml). - Uses a YAML configuration file that ends with virtualbox.(yml|yaml) or vbox.(yml|yaml).
- The inventory_hostname is always the 'Name' of the virtualbox instance. - The inventory_hostname is always the 'Name' of the virtualbox instance.
- Groups can be assigned to the VMs using C(VBoxManage). Multiple groups can be assigned by using V(/) as a delimeter. - Groups can be assigned to the VMs using C(VBoxManage). Multiple groups can be assigned by using V(/) as a delimeter.
- A separate parameter, O(enable_advanced_group_parsing) is exposed to change grouping behaviour. See the parameter documentation for details. - A separate parameter, O(enable_advanced_group_parsing) is exposed to change grouping behaviour. See the parameter documentation for details.
extends_documentation_fragment: extends_documentation_fragment:
- constructed - constructed
- inventory_cache - inventory_cache
options: options:
plugin: plugin:
description: token that ensures this is a source file for the 'virtualbox' plugin description: token that ensures this is a source file for the 'virtualbox' plugin
type: string type: string
@ -52,9 +52,9 @@ DOCUMENTATION = '''
default: false default: false
type: bool type: bool
version_added: 9.2.0 version_added: 9.2.0
''' """
EXAMPLES = ''' EXAMPLES = r"""
--- ---
# file must be named vbox.yaml or vbox.yml # file must be named vbox.yaml or vbox.yml
plugin: community.general.virtualbox plugin: community.general.virtualbox
@ -69,7 +69,7 @@ compose:
plugin: community.general.virtualbox plugin: community.general.virtualbox
groups: groups:
container: "'minis' in (inventory_hostname)" container: "'minis' in (inventory_hostname)"
''' """
import os import os

View file

@ -39,8 +39,30 @@ options:
- V(CAA) has been added in community.general 6.3.0. - V(CAA) has been added in community.general 6.3.0.
type: str type: str
default: 'A' default: 'A'
choices: [A, ALL, AAAA, CAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, RRSIG, SOA, SPF, choices:
SRV, SSHFP, TLSA, TXT] - A
- ALL
- AAAA
- CAA
- CNAME
- DNAME
- DNSKEY
- DS
- HINFO
- LOC
- MX
- NAPTR
- NS
- NSEC3PARAM
- PTR
- RP
- RRSIG
- SOA
- SPF
- SRV
- SSHFP
- TLSA
- TXT
flat: flat:
description: If 0 each record is returned as a dictionary, otherwise a string. description: If 0 each record is returned as a dictionary, otherwise a string.
type: int type: int

View file

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

View file

@ -6,12 +6,12 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = '''
name: ansible_type name: ansible_type
short_description: Validate input type short_description: Validate input type
version_added: "9.2.0" version_added: "9.2.0"
author: Vladimir Botka (@vbotka) author: Vladimir Botka (@vbotka)
description: This test validates input type. description: This test validates input type.
options: options:
_input: _input:
description: Input data. description: Input data.
type: raw type: raw
@ -27,10 +27,10 @@ DOCUMENTATION = '''
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Substitution converts str to AnsibleUnicode or _AnsibleTaggedStr # Substitution converts str to AnsibleUnicode or _AnsibleTaggedStr
# ---------------------------------------------------------------- # ----------------------------------------------------------------
---
# String. AnsibleUnicode or _AnsibleTaggedStr. # String. AnsibleUnicode or _AnsibleTaggedStr.
dtype: dtype:
- AnsibleUnicode - AnsibleUnicode
@ -39,6 +39,7 @@ data: "abc"
result: '{{ data is community.general.ansible_type(dtype) }}' result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# String. AnsibleUnicode/_AnsibleTaggedStr alias str. # String. AnsibleUnicode/_AnsibleTaggedStr alias str.
alias: {"AnsibleUnicode": "str", "_AnsibleTaggedStr": "str"} alias: {"AnsibleUnicode": "str", "_AnsibleTaggedStr": "str"}
dtype: str dtype: str
@ -46,6 +47,7 @@ data: "abc"
result: '{{ data is community.general.ansible_type(dtype, alias) }}' result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true # result => true
---
# List. All items are AnsibleUnicode/_AnsibleTaggedStr. # List. All items are AnsibleUnicode/_AnsibleTaggedStr.
dtype: dtype:
- list[AnsibleUnicode] - list[AnsibleUnicode]
@ -54,6 +56,7 @@ data: ["a", "b", "c"]
result: '{{ data is community.general.ansible_type(dtype) }}' result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# Dictionary. All keys and values are AnsibleUnicode/_AnsibleTaggedStr. # Dictionary. All keys and values are AnsibleUnicode/_AnsibleTaggedStr.
dtype: dtype:
- dict[AnsibleUnicode, AnsibleUnicode] - 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 # No substitution and no alias. Type of strings is str
# ---------------------------------------------------- # ----------------------------------------------------
---
# String # String
dtype: str dtype: str
result: '{{ "abc" is community.general.ansible_type(dtype) }}' result: '{{ "abc" is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# Integer # Integer
dtype: int dtype: int
result: '{{ 123 is community.general.ansible_type(dtype) }}' result: '{{ 123 is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# Float # Float
dtype: float dtype: float
result: '{{ 123.45 is community.general.ansible_type(dtype) }}' result: '{{ 123.45 is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# Boolean # Boolean
dtype: bool dtype: bool
result: '{{ true is community.general.ansible_type(dtype) }}' result: '{{ true is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# List. All items are strings. # List. All items are strings.
dtype: list[str] dtype: list[str]
result: '{{ ["a", "b", "c"] is community.general.ansible_type(dtype) }}' result: '{{ ["a", "b", "c"] is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# List of dictionaries. # List of dictionaries.
dtype: list[dict] dtype: list[dict]
result: '{{ [{"a": 1}, {"b": 2}] is community.general.ansible_type(dtype) }}' result: '{{ [{"a": 1}, {"b": 2}] is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# Dictionary. All keys are strings. All values are integers. # Dictionary. All keys are strings. All values are integers.
dtype: dict[str, int] dtype: dict[str, int]
result: '{{ {"a": 1} is community.general.ansible_type(dtype) }}' result: '{{ {"a": 1} is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# Dictionary. All keys are strings. All values are integers. # Dictionary. All keys are strings. All values are integers.
dtype: dict[str, int] dtype: dict[str, int]
result: '{{ {"a": 1, "b": 2} is community.general.ansible_type(dtype) }}' 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 # Type of strings is AnsibleUnicode, _AnsibleTaggedStr, or str
# ------------------------------------------------------------ # ------------------------------------------------------------
---
# Dictionary. The keys are integers or strings. All values are strings. # Dictionary. The keys are integers or strings. All values are strings.
alias: alias:
AnsibleUnicode: str AnsibleUnicode: str
@ -118,6 +130,7 @@ data: {1: 'a', 'b': 'b'}
result: '{{ data is community.general.ansible_type(dtype, alias) }}' result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true # result => true
---
# Dictionary. All keys are integers. All values are keys. # Dictionary. All keys are integers. All values are keys.
alias: alias:
AnsibleUnicode: str AnsibleUnicode: str
@ -128,6 +141,7 @@ data: {1: 'a', 2: 'b'}
result: '{{ data is community.general.ansible_type(dtype, alias) }}' result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true # result => true
---
# Dictionary. All keys are strings. Multiple types values. # Dictionary. All keys are strings. Multiple types values.
alias: alias:
AnsibleUnicode: str AnsibleUnicode: str
@ -135,10 +149,11 @@ alias:
_AnsibleTaggedInt: int _AnsibleTaggedInt: int
_AnsibleTaggedFloat: float _AnsibleTaggedFloat: float
dtype: dict[str, bool|dict|float|int|list|str] 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: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true # result => true
---
# List. Multiple types items. # List. Multiple types items.
alias: alias:
AnsibleUnicode: str AnsibleUnicode: str
@ -146,25 +161,28 @@ alias:
_AnsibleTaggedInt: int _AnsibleTaggedInt: int
_AnsibleTaggedFloat: float _AnsibleTaggedFloat: float
dtype: list[bool|dict|float|int|list|str] 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: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true # result => true
# Option dtype is list # Option dtype is list
# -------------------- # --------------------
---
# AnsibleUnicode, _AnsibleTaggedStr, or str # AnsibleUnicode, _AnsibleTaggedStr, or str
dtype: ['AnsibleUnicode', '_AnsibleTaggedStr', 'str'] dtype: ['AnsibleUnicode', '_AnsibleTaggedStr', 'str']
data: abc data: abc
result: '{{ data is community.general.ansible_type(dtype) }}' result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# float or int # float or int
dtype: ['float', 'int', "_AnsibleTaggedInt", "_AnsibleTaggedFloat"] dtype: ['float', 'int', "_AnsibleTaggedInt", "_AnsibleTaggedFloat"]
data: 123 data: 123
result: '{{ data is community.general.ansible_type(dtype) }}' result: '{{ data is community.general.ansible_type(dtype) }}'
# result => true # result => true
---
# float or int # float or int
dtype: ['float', 'int', "_AnsibleTaggedInt", "_AnsibleTaggedFloat"] dtype: ['float', 'int', "_AnsibleTaggedInt", "_AnsibleTaggedFloat"]
data: 123.45 data: 123.45
@ -174,6 +192,7 @@ result: '{{ data is community.general.ansible_type(dtype) }}'
# Multiple alias # Multiple alias
# -------------- # --------------
---
# int alias number # int alias number
alias: alias:
int: number int: number
@ -185,6 +204,7 @@ data: 123
result: '{{ data is community.general.ansible_type(dtype, alias) }}' result: '{{ data is community.general.ansible_type(dtype, alias) }}'
# result => true # result => true
---
# float alias number # float alias number
alias: alias:
int: number int: number
@ -198,7 +218,7 @@ result: '{{ data is community.general.ansible_type(dtype, alias) }}'
''' '''
RETURN = ''' RETURN = '''
_value: _value:
description: Whether the data type is valid. description: Whether the data type is valid.
type: bool type: bool
''' '''

View file

@ -17,13 +17,13 @@ else:
DOCUMENTATION = ''' DOCUMENTATION = '''
name: fqdn_valid name: fqdn_valid
short_description: Validates fully-qualified domain names against RFC 1123 short_description: Validates fully-qualified domain names against RFC 1123
version_added: 8.1.0 version_added: 8.1.0
author: Vladimir Botka (@vbotka) author: Vladimir Botka (@vbotka)
requirements: requirements:
- fqdn>=1.5.1 (PyPI) - fqdn>=1.5.1 (PyPI)
description: description:
- This test validates Fully Qualified Domain Names (FQDNs) - This test validates Fully Qualified Domain Names (FQDNs)
conforming to the Internet Engineering Task Force specification conforming to the Internet Engineering Task Force specification
RFC 1123 and RFC 952. RFC 1123 and RFC 952.
@ -37,7 +37,7 @@ DOCUMENTATION = '''
test is not intended to achieve functional parity with CA test is not intended to achieve functional parity with CA
issuance. issuance.
- Single label names are allowed by default (O(min_labels=1)). - Single label names are allowed by default (O(min_labels=1)).
options: options:
_input: _input:
description: Name of the host. description: Name of the host.
type: str type: str
@ -69,7 +69,7 @@ EXAMPLES = '''
''' '''
RETURN = ''' RETURN = '''
_value: _value:
description: Whether the name is valid. description: Whether the name is valid.
type: bool type: bool
''' '''

View file

@ -17,4 +17,5 @@ plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt' plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
plugins/modules/xfconf.py validate-modules:return-syntax-error plugins/modules/xfconf.py validate-modules:return-syntax-error
plugins/test/ansible_type.py yamllint:unparsable-with-libyaml
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes

View file

@ -18,4 +18,5 @@ plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt' plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
plugins/modules/udm_user.py import-3.12 # Uses deprecated stdlib library 'crypt' plugins/modules/udm_user.py import-3.12 # Uses deprecated stdlib library 'crypt'
plugins/modules/xfconf.py validate-modules:return-syntax-error plugins/modules/xfconf.py validate-modules:return-syntax-error
plugins/test/ansible_type.py yamllint:unparsable-with-libyaml
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes