Skip to content

Commit 2bccf46

Browse files
committed
app.docker better pillar
1 parent d0b85c7 commit 2bccf46

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

app/docker.sls

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ docker_pillar_render_errors:
1515
{%- include "app/_pkg.sls" with context %}
1616
{%- include "app/_pre_deploy.sls" with context %}
1717

18-
{%- if pillar["app"]["docker"]["docker-ce_version"] is defined %}
19-
{%- set docker_ce = {"version": pillar["app"]["docker"]["docker-ce_version"],
20-
"daemon_json": '{"iptables": false}'} %}
18+
# app:docker:docker-ce_version - legacy wrongly named key
19+
# app:docker:version - correct key name
20+
# app:docker:daemon_json - optional, if not set, it will be set to '{"iptables": false}' by default
21+
{%- set docker_version = pillar["app"]["docker"].get("version", pillar["app"]["docker"].get("docker-ce_version")) %}
22+
{%- set docker_daemon_json = pillar["app"]["docker"].get("daemon_json", '{"iptables": false}') %}
23+
# if docker_version is defined and not empty, include docker-ce.sls with the specified version and daemon_json
24+
{%- if docker_version is defined and docker_version %}
25+
{%- set docker_ce = {"version": docker_version, "daemon_json": docker_daemon_json} %}
2126
{%- include "docker-ce/docker-ce.sls" with context %}
2227
{%- endif %}
2328

app/pillar.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ app:
272272
}
273273
274274
docker:
275-
docker-ce_version: 18.06.1 # optional, do not manage docker installation if omitted
275+
version: 18.06.1 # optional, do not manage docker installation if omitted
276+
#docker-ce_version: 18.06.1 # old name for previous key, wrongly named, still supported for backward compatibility, but will be removed in future
277+
#daemon_json: '{"iptables": false}' # optional, to manage /etc/docker/daemon.json, '{"iptables": false}' by default
276278
#networks: # optional, create custom docker networks
277279
# proto:
278280
# subnet: 172.18.0.0/24

0 commit comments

Comments
 (0)