Created
May 17, 2016 15:58
-
-
Save dmsimard/e0b6ca95981ff85ded69bb22e33f06ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro display_result(result, hdr) %} | |
{% if result is mapping %} | |
{% if 'item' in result %} | |
<{{hdr}}>Item</{{hdr}}> | |
<pre>{{result.item|to_nice_json}}</pre> | |
{% endif %} | |
{% for attr in result.keys()|sort | |
if attr not in ['item', 'changed', 'stdout_lines'] %} | |
{% if result[attr]|default(False) %} | |
<{{hdr}}>{{attr|title}}</{{hdr}}> | |
{% if result[attr] is string %} | |
<pre>{{result[attr]}}</pre> | |
{% elif result[attr] is mapping or result[attr] is iterable%} | |
<pre>{{result[attr]|to_nice_json}}</pre> | |
{% else %} | |
<pre>{{result}}</pre> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
{% else %} | |
<pre>{{result|to_nice_json}}</pre> | |
{% endif %} | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment