Debian Codegraph @

lib/ansible/plugins/doc_fragments/result_format_callback.py

raw
1 # -*- coding: utf-8 -*-
2
3 # Copyright: (c) 2017, Ansible Project
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 from __future__ import annotations
6
7
8 class ModuleDocFragment(object):
9
10 DOCUMENTATION = r"""
11 options:
12 result_format:
13 name: Format of the task result
14 description:
15 - Define the task result format used in the callback output.
16 - These formats do not cause the callback to emit valid JSON or YAML formats.
17 - The output contains these formats interspersed with other non-machine parsable data.
18 type: str
19 default: json
20 env:
21 - name: ANSIBLE_CALLBACK_RESULT_FORMAT
22 ini:
23 - key: callback_result_format
24 section: defaults
25 choices:
26 - json
27 - yaml
28 version_added: '2.13'
29 result_indentation:
30 name: Indentation of the result
31 description:
32 - Allows to configure indentation for YAML and verbose/pretty JSON.
33 - Please note that for O(result_format=yaml), only values between 2 and 9 will be handled as expected by PyYAML.
34 If indentation is set to 1, or to 10 or larger, the first level of indentation will be used,
35 but all further indentations will be by 2 spaces.
36 type: int
37 default: 4
38 env:
39 - name: ANSIBLE_CALLBACK_RESULT_INDENTATION
40 ini:
41 - key: callback_result_indentation
42 section: defaults
43 version_added: '2.20'
44 result_yaml_line_width:
45 name: Line width of YAML output
46 description:
47 - Configure the line width used for YAML. The YAML serializer will try to break longer lines.
48 type: str
49 default: default
50 choices:
51 default: Use PyYAML's default value, which is around 80 characters.
52 no-break: Disable line breaks.
53 terminal-width: Use the detected terminal width that is also used for other output of this callback.
54 env:
55 - name: ANSIBLE_CALLBACK_YAML_LINE_WIDTH
56 ini:
57 - key: callback_result_yaml_line_width
58 section: defaults
59 version_added: '2.21'
60 pretty_results:
61 name: Configure output for readability
62 description:
63 - Configure the result format to be more readable.
64 - When O(result_format) is set to V(yaml) this option defaults to V(true), and defaults
65 to V(false) when configured to V(json).
66 - Setting this option to V(true) will force V(json) and V(yaml) results to always be pretty
67 printed regardless of verbosity.
68 - When set to V(true) and used with the V(yaml) result format, this option will
69 modify module responses in an attempt to produce a more human friendly output at the expense
70 of correctness, and should not be relied upon to aid in writing variable manipulations
71 or conditionals. For correctness, set this option to V(false) or set O(result_format) to V(json).
72 type: bool
73 default: null
74 env:
75 - name: ANSIBLE_CALLBACK_FORMAT_PRETTY
76 ini:
77 - key: callback_format_pretty
78 section: defaults
79 version_added: '2.13'
80 """