summaryrefslogtreecommitdiff
path: root/lib/ansible/runner
diff options
context:
space:
mode:
authorMichael Peters <mpeters@stanleygibbons.com>2014-06-19 12:25:36 -0400
committerMichael DeHaan <michael.dehaan@gmail.com>2014-08-08 11:28:48 -0400
commit3ba516ac25ac6e9f60debb8e45e467032c5ff226 (patch)
treee9c92b5252e2d20c03a4bb4263a6ec0c1e441c20 /lib/ansible/runner
parent2d2178f2c5ea284b4ee1dd068b264370ee27f059 (diff)
downloadansible-3ba516ac25ac6e9f60debb8e45e467032c5ff226.tar.gz
adding min() and max() filters for use in Jinja templates
Diffstat (limited to 'lib/ansible/runner')
-rw-r--r--lib/ansible/runner/filter_plugins/core.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ansible/runner/filter_plugins/core.py b/lib/ansible/runner/filter_plugins/core.py
index b8eecb0376..7ca0f93742 100644
--- a/lib/ansible/runner/filter_plugins/core.py
+++ b/lib/ansible/runner/filter_plugins/core.py
@@ -183,6 +183,14 @@ def union(a, b):
c = unique(a + b)
return c
+def min(a):
+ _min = __builtins__.get('min')
+ return _min(a);
+
+def max(a):
+ _max = __builtins__.get('max')
+ return _max(a);
+
def version_compare(value, version, operator='eq', strict=False):
''' Perform a version comparison on a value '''
op_map = {
@@ -289,6 +297,8 @@ class FilterModule(object):
'difference': difference,
'symmetric_difference': symmetric_difference,
'union': union,
+ 'min' : min,
+ 'max' : max,
# version comparison
'version_compare': version_compare,