Skip to content

Instantly share code, notes, and snippets.

Created March 30, 2015 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/511bf8eaf22ab68ae8b8 to your computer and use it in GitHub Desktop.
Save anonymous/511bf8eaf22ab68ae8b8 to your computer and use it in GitHub Desktop.
Pillar:
upstreams: ['127.0.0.1:8008','127.0.0.2:8008','127.0.0.3:8008']
sls:
- context:
{% if pillar['upstreams'] is defined %}
backends: "{{ pillar['upstreams'] }}"
{% endif %}
template:
{% for server in backends %} server {{server}};
{% endfor %}}
produces:
upstream couponcabin {
server 1;
server 2;
server 7;
server .;
server 0;
...
}
while template:
{% for server in [backends] %} server {{server}};
{% endfor %}}
produces:
server ['127.0.0.1:8008', '127.0.0.2:8008', '127.0.0.3:8008'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment