mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Document new PIPE_ONCE macro
This commit is contained in:
parent
cd32597af0
commit
ec16b854a5
1 changed files with 18 additions and 6 deletions
|
@ -583,6 +583,18 @@ is an example using the authorized_key module, which requires the actual text of
|
|||
|
||||
The "$PIPE" macro works just like file, except you would feed it a command string instead. It executes locally, not remotely, as does $FILE.
|
||||
|
||||
Because Ansible uses lazy evaluation, a "$PIPE" macro will be executed each time it is used. For
|
||||
example, it will be executed separately for each host, and if it is used in a variable definition,
|
||||
it will be executed each time the variable is evaluated.
|
||||
|
||||
The "$PIPE_ONCE" macro is an alternative that uses a caching strategy: it is executed only once, and
|
||||
subsequent accesses use the cached value. One use case is for computing a timestamp that is intended
|
||||
to be the same across all tasks and hosts that use it::
|
||||
|
||||
vars:
|
||||
timestamp: $PIPE_ONCE(date +%Y%m%d-%H%M%S)
|
||||
|
||||
|
||||
Selecting Files And Templates Based On Variables
|
||||
````````````````````````````````````````````````
|
||||
|
||||
|
|
Loading…
Reference in a new issue