Skip to content

Instantly share code, notes, and snippets.

View vshuraeff's full-sized avatar
💭
I may be slow to respond.

Valentin vshuraeff

💭
I may be slow to respond.
View GitHub Profile
@halberom
halberom / 00_description
Last active April 14, 2022 19:23
ansible - example of using filters to change each item in a list
The problem:
I wanted to use the jinja 'map' filter to modify each item in a string, in this simple
example, adding '.conf' to each item.
The 'format' filter in jinja takes arguments (value, *args, **kwargs). Unfortunately,
it uses 'value' as the pattern. When called inside map 'value' is the current item in
the list, or in other words *args as far as format is concerned. So it's the wrong way
around.