Doc update regarding variables' behavior

This commit is contained in:
Emmanuel BENOîT 2022-09-17 10:30:37 +02:00
parent 9c4cc09021
commit 6ca723c74e
2 changed files with 6 additions and 5 deletions

View file

@ -52,9 +52,8 @@ containing the list of instructions which are part of the block. It may have
a `rescue` field, containing a list of instructions which will be executed on
error, and `always`, which may contain a list of instructions to execute in
all cases. If the `locals` field is defined, it must contain a table of local
variables to define. Any local variable defined by the instructions under
`block`, `rescue` or `always` will go out of scope once the block finishes
executing.
variables to define. If these variables already exist, their state will be
saved and they will be restored after the block is done executing.
A somewhat silly example can be found in the `example` directory. Trying to
execute it using `ansible-inventory --graph` results in the following output.

View file

@ -35,7 +35,8 @@ DOCUMENTATION = """
template that will return a list). The instruction will be repeated
for each value in the list. The C(loop_var) field may be added to
specify the name of the variable into which the current value will
be written; by default the C(item) variable will be used.
be written; by default the C(item) variable will be used. Once the
loop execution ends, the loop variable's previous state is restored.
- The C(when) field, if present, must contain a Jinja expression
representing a condition which will be checked before the instruction
is executed.
@ -49,7 +50,8 @@ DOCUMENTATION = """
of instructions to execute in all cases. If the C(locals) field is
defined, it must contain a table of local variables to define. Any
local variable defined by the instructions under C(block), C(rescue)
or C(always) will go out of scope once the block finishes executing.
or C(always) will go out of scope once the block finishes executing,
and the previous values, if any, will be restored.
- C(create_group) creates a group. The name of the group must be
provided using the C(group) field, which must be a valid name or a
Jinja template that evaluates to a valid name. In addition, a