Home WSL2 Jekyll installation Help
Post
Cancel

WSL2 Jekyll installation Help

Ansible Jinja2 helpers

This post is holding different good to know functions of Jinja2 templating. They are mainly for use with Ansible, but might work in any language that support jinja2 - like Python.

Well Known (easy to find):

The Default jinja2 clause:

1
2
3


Lesser Known:

Generate list from nested vars:

1
2
3
4
5
6
7
8
9
10
11
somenestedvar:
    var1:
    - value1
    - value2
    var2:
    - value2
    - value3

    debug:
        msg: "
    # generates a unique list of values from somenestedvar the .values() shows the values of the variable.
This post is licensed under CC BY 4.0 by the author.