-
-
Save wnkz/306063f54dcfb2f228b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# foo-docker-app.sls | |
{% set app = salt['pillar.get']('docker-apps:foo', {}) %} | |
{% if app %} | |
[...] | |
{{ app.name }}-service: | |
docker.running: | |
- name: {{ app.name }} | |
- container: {{ app.name }} | |
- port_bindings: | |
"80/tcp": | |
HostIp: "" | |
HostPort: "8001" | |
- require: | |
- docker: {{ app.name }}-container | |
- watch: | |
- docker: {{ app.name }}-container | |
[...] | |
{% endif %} | |
# ----- | |
# docker-apps.sls | |
docker-apps: | |
foo: | |
name: foo | |
iname: bar/foo | |
tag: latest | |
port_bindings: | |
"80/tcp": | |
HostIp: "" | |
HostPort: "8001" |
another option would be to
{% set app = salt['pillar.get']('docker-apps:foo', {}).items %}
this way (might need some tweaking thought, again, i'm not testing anything) you should be able to access everything in your pillar with app.get('name'), app.get('iname') etc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add this before the if statement:
{% set portbinding = salt['pillar.get']('docker-apps:foo:port_bindings'; {}) %}
replace {{ app.port_bindings }} with {{ portbinding }}
that should do the trick, although I haven't tested it..