Document all filter and test plugins (#4597) (#4604)

* Fix/improve docs.

* Document the a_module test.

* Document the dict filter.

* Linting.

* Add more filter docs.

* More filters.

* Update BOTMETA.

* Add another plugin.

* Fix typos.

* Add explicit entries.

* Fix lookup documentation.

(cherry picked from commit f055f47161)
This commit is contained in:
Felix Fontein 2022-05-02 07:49:11 +02:00 committed by GitHub
parent 020fa081d7
commit 0ba06f8d82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 992 additions and 20 deletions

View file

@ -21,6 +21,67 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: jc
short_description: Convert output of many shell commands and file-types to JSON
version_added: 1.1.0
author: Kelly Brazil (@kellyjonbrazil)
description:
- Convert output of many shell commands and file-types to JSON.
- Uses the L(jc library,https://github.com/kellyjonbrazil/jc).
positional: parser
options:
_input:
description: The data to convert.
type: string
required: true
parser:
description:
- The correct parser for the input data.
- For exmaple C(ifconfig).
- See U(https://github.com/kellyjonbrazil/jc#parsers) for the latest list of parsers.
type: string
required: true
quiet:
description: Set to C(false) to not suppress warnings.
type: boolean
default: true
raw:
description: Set to C(true) to return pre-processed JSON.
type: boolean
default: false
requirements:
- jc (https://github.com/kellyjonbrazil/jc)
'''
EXAMPLES = '''
- name: Run command
ansible.builtin.command: uname -a
register: result
- name: Convert command's result to JSON
ansible.builtin.debug:
msg: "{{ result.stdout | community.general.jc('uname') }}"
# Possible output:
#
# "msg": {
# "hardware_platform": "x86_64",
# "kernel_name": "Linux",
# "kernel_release": "4.15.0-112-generic",
# "kernel_version": "#113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020",
# "machine": "x86_64",
# "node_name": "kbrazil-ubuntu",
# "operating_system": "GNU/Linux",
# "processor": "x86_64"
# }
'''
RETURN = '''
_value:
description: The processed output.
type: any
'''
from ansible.errors import AnsibleError, AnsibleFilterError
import importlib