Debian Codegraph @

lib/ansible/plugins/doc_fragments/constructed.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 strict:
13 description:
14 - If V(yes) make invalid entries a fatal error, otherwise skip and continue.
15 - Since it is possible to use facts in the expressions they might not always be available
16 and we ignore those errors by default.
17 type: bool
18 default: no
19 compose:
20 description: Create vars from jinja2 expressions.
21 type: dict
22 default: {}
23 groups:
24 description: Add hosts to group based on Jinja2 conditionals.
25 type: dict
26 default: {}
27 keyed_groups:
28 description: Add hosts to group based on the values of a variable.
29 type: list
30 default: []
31 elements: dict
32 suboptions:
33 parent_group:
34 type: str
35 description: parent group for keyed group.
36 prefix:
37 type: str
38 description: A keyed group name will start with this prefix.
39 default: ''
40 separator:
41 type: str
42 description: separator used to build the keyed group name.
43 default: "_"
44 key:
45 type: str
46 description:
47 - The key from input dictionary used to generate groups.
48 default_value:
49 description:
50 - The default value when the host variable's value is V(None) or an empty string.
51 - This option is mutually exclusive with O(keyed_groups[].trailing_separator).
52 type: str
53 version_added: '2.12'
54 trailing_separator:
55 description:
56 - Set this option to V(false) to omit the O(keyed_groups[].separator) after the host variable when the value is V(None) or an empty string.
57 - This option is mutually exclusive with O(keyed_groups[].default_value).
58 type: bool
59 default: true
60 version_added: '2.12'
61 use_extra_vars:
62 version_added: '2.11'
63 description: Merge extra vars into the available variables for composition (highest precedence).
64 type: bool
65 default: false
66 ini:
67 - section: inventory_plugins
68 key: use_extra_vars
69 env:
70 - name: ANSIBLE_INVENTORY_USE_EXTRA_VARS
71 leading_separator:
72 description:
73 - Use in conjunction with O(keyed_groups).
74 - By default, a keyed group that does not have a prefix or a separator provided will have a name that starts with an underscore.
75 - This is because the default prefix is V("") and the default separator is V("_").
76 - Set this option to V(false) to omit the leading underscore (or other separator) if no prefix is given.
77 - If the group name is derived from a mapping the separator is still used to concatenate the items.
78 - To not use a separator in the group name at all, set the separator for the keyed group to an empty string instead.
79 type: boolean
80 default: True
81 version_added: '2.11'
82 notes:
83 - Inventories are not finalized at this stage, so the auto populated C(all) and C(ungrouped) groups will
84 only reflect what previous inventory sources explicitly added to them.
85 - Runtime 'magic variables' are not available during inventory construction. For example, C(groups) and C(hostvars) do not exist yet.
86 """