summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fontein <felix@fontein.de>2022-08-04 22:48:18 +0200
committerGitHub <noreply@github.com>2022-08-04 15:48:18 -0500
commitb2481eb15831071c78ef59127656328c4f9c7830 (patch)
tree653a6b92534d7f452d3c9c6f291bce6e9fbe94c4
parenta2984758dc727eb90cb9717e3b966c782b32cae8 (diff)
downloadansible-b2481eb15831071c78ef59127656328c4f9c7830.tar.gz
Module/plugin docs: (#78380) (#78447)
(cherry picked from commit 7e634f54c3b98372152a722ddf85919cf3f5fe86)
-rw-r--r--lib/ansible/modules/apt.py7
-rw-r--r--lib/ansible/modules/assemble.py2
-rw-r--r--lib/ansible/modules/find.py10
-rw-r--r--lib/ansible/modules/getent.py5
-rw-r--r--lib/ansible/modules/setup.py6
-rw-r--r--lib/ansible/modules/template.py2
-rw-r--r--lib/ansible/plugins/doc_fragments/shell_windows.py6
-rw-r--r--lib/ansible/plugins/lookup/csvfile.py4
8 files changed, 24 insertions, 18 deletions
diff --git a/lib/ansible/modules/apt.py b/lib/ansible/modules/apt.py
index 121eff935c..eb9479d941 100644
--- a/lib/ansible/modules/apt.py
+++ b/lib/ansible/modules/apt.py
@@ -332,7 +332,12 @@ stdout:
description: output from apt
returned: success, when needed
type: str
- sample: "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following extra packages will be installed:\n apache2-bin ..."
+ sample: |-
+ Reading package lists...
+ Building dependency tree...
+ Reading state information...
+ The following extra packages will be installed:
+ apache2-bin ...
stderr:
description: error output from apt
returned: success, when needed
diff --git a/lib/ansible/modules/assemble.py b/lib/ansible/modules/assemble.py
index 8fad49c3b9..ba74a555de 100644
--- a/lib/ansible/modules/assemble.py
+++ b/lib/ansible/modules/assemble.py
@@ -57,7 +57,7 @@ options:
description:
- Assemble files only if C(regex) matches the filename.
- If not set, all files are assembled.
- - Every "\" (backslash) must be escaped as "\\" to comply to YAML syntax.
+ - Every C(\) (backslash) must be escaped as C(\\) to comply to YAML syntax.
- Uses L(Python regular expressions,https://docs.python.org/3/library/re.html).
type: str
ignore_hidden:
diff --git a/lib/ansible/modules/find.py b/lib/ansible/modules/find.py
index aa57aa531c..eb9c8aa839 100644
--- a/lib/ansible/modules/find.py
+++ b/lib/ansible/modules/find.py
@@ -35,19 +35,19 @@ options:
least one of the patterns specified. Multiple patterns can be specified using a list.
- The pattern is matched against the file base name, excluding the directory.
- When using regexen, the pattern MUST match the ENTIRE file name, not just parts of it. So
- if you are looking to match all files ending in .default, you'd need to use '.*\.default'
- as a regexp and not just '\.default'.
+ if you are looking to match all files ending in .default, you'd need to use C(.*\.default)
+ as a regexp and not just C(\.default).
- This parameter expects a list, which can be either comma separated or YAML. If any of the
patterns contain a comma, make sure to put them in a list to avoid splitting the patterns
in undesirable ways.
- - Defaults to '*' when C(use_regex=False), or '.*' when C(use_regex=True).
+ - Defaults to C(*) when I(use_regex=False), or C(.*) when I(use_regex=True).
type: list
aliases: [ pattern ]
elements: str
excludes:
description:
- - One or more (shell or regex) patterns, which type is controlled by C(use_regex) option.
- - Items whose basenames match an C(excludes) pattern are culled from C(patterns) matches.
+ - One or more (shell or regex) patterns, which type is controlled by I(use_regex) option.
+ - Items whose basenames match an I(excludes) pattern are culled from I(patterns) matches.
Multiple patterns can be specified using a list.
type: list
aliases: [ exclude ]
diff --git a/lib/ansible/modules/getent.py b/lib/ansible/modules/getent.py
index b2929febad..fdfcf43bf2 100644
--- a/lib/ansible/modules/getent.py
+++ b/lib/ansible/modules/getent.py
@@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
-DOCUMENTATION = '''
+DOCUMENTATION = r'''
---
module: getent
short_description: A wrapper to the unix getent utility
@@ -36,7 +36,8 @@ options:
version_added: "2.9"
split:
description:
- - "Character used to split the database values into lists/arrays such as ':' or '\t', otherwise it will try to pick one depending on the database."
+ - Character used to split the database values into lists/arrays such as C(:) or C(\t),
+ otherwise it will try to pick one depending on the database.
type: str
fail_key:
description:
diff --git a/lib/ansible/modules/setup.py b/lib/ansible/modules/setup.py
index c4e5d08209..2776ac1c02 100644
--- a/lib/ansible/modules/setup.py
+++ b/lib/ansible/modules/setup.py
@@ -113,7 +113,7 @@ author:
- "Michael DeHaan"
'''
-EXAMPLES = """
+EXAMPLES = r"""
# Display facts from all hosts and store them indexed by I(hostname) at C(/tmp/facts).
# ansible all -m ansible.builtin.setup --tree /tmp/facts
@@ -158,8 +158,8 @@ EXAMPLES = """
# Collect no facts, even the default minimum subset of facts:
# ansible all -m ansible.builtin.setup -a 'gather_subset=!all,!min'
-# Display facts from Windows hosts with custom facts stored in C(C:\\custom_facts).
-# ansible windows -m ansible.builtin.setup -a "fact_path='c:\\custom_facts'"
+# Display facts from Windows hosts with custom facts stored in C:\custom_facts.
+# ansible windows -m ansible.builtin.setup -a "fact_path='c:\custom_facts'"
# Gathers facts for the machines in the dbservers group (a.k.a Delegating facts)
- hosts: app_servers
diff --git a/lib/ansible/modules/template.py b/lib/ansible/modules/template.py
index 29ddb13655..faff7aa9c1 100644
--- a/lib/ansible/modules/template.py
+++ b/lib/ansible/modules/template.py
@@ -25,7 +25,7 @@ options:
default: no
version_added: '2.4'
notes:
-- For Windows you can use M(ansible.windows.win_template) which uses '\\r\\n' as C(newline_sequence) by default.
+- For Windows you can use M(ansible.windows.win_template) which uses C(\r\n) as C(newline_sequence) by default.
- The C(jinja2_native) setting has no effect. Native types are never used in the C(template) module which is by design used for generating text files.
For working with templates and utilizing Jinja2 native types see the C(jinja2_native) parameter of the C(template lookup).
seealso:
diff --git a/lib/ansible/plugins/doc_fragments/shell_windows.py b/lib/ansible/plugins/doc_fragments/shell_windows.py
index af4de955ff..ac52c609b4 100644
--- a/lib/ansible/plugins/doc_fragments/shell_windows.py
+++ b/lib/ansible/plugins/doc_fragments/shell_windows.py
@@ -9,13 +9,13 @@ class ModuleDocFragment(object):
# Windows shell documentation fragment
# FIXME: set_module_language don't belong here but must be set so they don't fail when someone
# get_option('set_module_language') on this plugin
- DOCUMENTATION = """
+ DOCUMENTATION = r"""
options:
async_dir:
description:
- Directory in which ansible will keep async job information.
- - Before Ansible 2.8, this was set to C(remote_tmp + "\\.ansible_async").
- default: '%USERPROFILE%\\.ansible_async'
+ - Before Ansible 2.8, this was set to C(remote_tmp + "\.ansible_async").
+ default: '%USERPROFILE%\.ansible_async'
ini:
- section: powershell
key: async_dir
diff --git a/lib/ansible/plugins/lookup/csvfile.py b/lib/ansible/plugins/lookup/csvfile.py
index 7f66187db0..5932d77c37 100644
--- a/lib/ansible/plugins/lookup/csvfile.py
+++ b/lib/ansible/plugins/lookup/csvfile.py
@@ -4,7 +4,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
-DOCUMENTATION = """
+DOCUMENTATION = r"""
name: csvfile
author: Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>
version_added: "1.5"
@@ -20,7 +20,7 @@ DOCUMENTATION = """
default:
description: what to return if the value is not found in the file.
delimiter:
- description: field separator in the file, for a tab you can specify C(TAB) or C(\\t).
+ description: field separator in the file, for a tab you can specify C(TAB) or C(\t).
default: TAB
file:
description: name of the CSV/TSV file to open.