diff options
| author | Toshio Kuratomi <a.badger@gmail.com> | 2014-12-16 15:42:22 -0800 |
|---|---|---|
| committer | Toshio Kuratomi <a.badger@gmail.com> | 2014-12-16 15:42:22 -0800 |
| commit | 7ab1e525755b155cc148abf5b5bba4cb34afb99a (patch) | |
| tree | 1b5ab22e2926c55107a5023991a1ef1a045c6f6d /docsite | |
| parent | dc8207177e86b8d2f92688309556b4368134841e (diff) | |
| parent | b07ce8b942d1d659257b0aebb6a17e1425e583d1 (diff) | |
| download | ansible-7ab1e525755b155cc148abf5b5bba4cb34afb99a.tar.gz | |
Merge pull request #9832 from bcoca/math_filters
math filters!
Diffstat (limited to 'docsite')
| -rw-r--r-- | docsite/rst/playbooks_variables.rst | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/docsite/rst/playbooks_variables.rst b/docsite/rst/playbooks_variables.rst index e198a45472..b4c5943ffb 100644 --- a/docsite/rst/playbooks_variables.rst +++ b/docsite/rst/playbooks_variables.rst @@ -311,6 +311,39 @@ To get a random list from an existing list:: note that when used with a non 'listable' item it is a noop, otherwise it always returns a list + +.. _math_stuff: + +Math +-------------------- +.. versionadded:: 1.9 + + +To see if something is actually a number:: + + {{ myvar | isnan }} + +Get the logarithm (default is e):: + + {{ myvar | log }} + +Get the base 10 logarithm:: + + {{ myvar | log(10) }} + +Give me the power of 2! (or 5):: + + {{ myvar | pow(2) }} + {{ myvar | pow(5) }} + +Square root, or the 5th:: + + {{ myvar | root }} + {{ myvar | root(5) }} + +Note that jinja2 already provides some like abs() and round(). + + .. _other_useful_filters: Other Useful Filters |
