diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /lib/ansible/plugins/filter/random.yml | |
parent | Initial commit. (diff) | |
download | ansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/ansible/plugins/filter/random.yml')
-rw-r--r-- | lib/ansible/plugins/filter/random.yml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/ansible/plugins/filter/random.yml b/lib/ansible/plugins/filter/random.yml new file mode 100644 index 0000000..b72dbb2 --- /dev/null +++ b/lib/ansible/plugins/filter/random.yml @@ -0,0 +1,35 @@ +DOCUMENTATION: + name: random + version_added: "2.6" + short_description: random number or list item + description: + - Use the input to either select a random element of a list or generate a random number. + positional: _input, start, step, seed + options: + _input: + description: A number or list/sequence, if it is a number it is the top bound for random number generation, if it is a sequence or list, the source of the random element selected. + type: raw + required: true + start: + description: Bottom bound for the random number/element generated. + type: int + step: + description: Subsets the defined range by only using this value to select the increments of it between start and end. + type: int + default: 1 + seed: + description: If specified use a pseudo random selection instead (repeatable). + type: str + +EXAMPLES: | + + # can be any item from the list + random_item: "{{ ['a','b','c'] | random }}" + + # cron line, select random minute repeatable for each host + "{{ 60 | random(seed=inventory_hostname) }} * * * * root /script/from/cron" + +RETURN: + _value: + description: Random number or list element. + type: raw |