summaryrefslogtreecommitdiff
path: root/docsite
diff options
context:
space:
mode:
authorBrian Coca <bcoca@ansible.com>2014-11-20 13:43:00 -0500
committerBrian Coca <bcoca@ansible.com>2014-11-20 13:43:00 -0500
commit0edaa6f790b8623506acc6981e980183b4f857b4 (patch)
tree3ff38c1ed2302c3557e9fc06179ea18ef35464bb /docsite
parent11b634104f3c989155c40a694476f9ff7718a08d (diff)
parentb592d7653db69860ebda5873a600098384e49818 (diff)
downloadansible-0edaa6f790b8623506acc6981e980183b4f857b4.tar.gz
Merge pull request #9270 from bcoca/do_the_shuffle
added new 'shuffle' filter
Diffstat (limited to 'docsite')
-rw-r--r--docsite/rst/playbooks_variables.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/docsite/rst/playbooks_variables.rst b/docsite/rst/playbooks_variables.rst
index 34d5a77be4..08b8ce60eb 100644
--- a/docsite/rst/playbooks_variables.rst
+++ b/docsite/rst/playbooks_variables.rst
@@ -297,6 +297,20 @@ Get a random number from 1 to 100 but in steps of 10::
{{ 100 |random(start=1, step=10) }} => 51
+Shuffle Filter
+--------------
+
+.. versionadded:: 1.8
+
+This filter will randomize an existing list, giving a differnt order every invocation.
+
+To get a random list from an existing list::
+
+ {{ ['a','b','c']|shuffle }} => ['c','a','b']
+ {{ ['a','b','c']|shuffle }} => ['b','c','a']
+
+note that when used with a non 'listable' item it is a noop, otherwise it always returns a list
+
.. _other_useful_filters:
Other Useful Filters