From 3534bdf953bd0ab98c521b0f5e6ea5523d3f9ea8 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Sun, 5 Oct 2014 20:53:06 -0400 Subject: added new 'shuffle' filter --- docsite/rst/playbooks_variables.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'docsite') diff --git a/docsite/rst/playbooks_variables.rst b/docsite/rst/playbooks_variables.rst index 86146cdd0f..ba85210293 100644 --- a/docsite/rst/playbooks_variables.rst +++ b/docsite/rst/playbooks_variables.rst @@ -297,6 +297,19 @@ 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'] + + .. _other_useful_filters: Other Useful Filters -- cgit v1.2.1