I need to create a list of dictionaries using only Jinja2 from another list, as input.
One key/value pair is static and always the same, the other changes value.
Input:
targets: ["abc", "qwe", "def"]
I know that the server will always be xyz.
Final
connections:
- { "target": "abc", "server": "xyz" }
- { "target": "qwe", "server": "xyz" }
- { "target": "def", "server": "xyz" }
I tried this:
"{{ dict(targets | zip_longest([], fillvalue='xyz')) }}"
But, that just takes one for key and the other for value.