Jinja2 Howto Get String Outside for Loop
Long time ago while I was rewriting our salt formula I got problems with getting value outside for loop. After some investigation and reading documentation I got next text to get what I need: {%- set dc_name = ['jotunheimr'] %} {%- for s_group, s_details in pillar.get('server-groups', {}).items() %} {%- set s_srvs = pillar.get('server-groups', {}) %} {%- for srv in s_srvs[s_group] %} {%- if srv == grains['id'] %} {%- do dc_name.append(s_group) %} {%- endif %} {%- endfor %} {%- endfor %} {%- if dc_name|length > 1 %} {%- endif %} {%- set bacula_path = salt['pillar....