Created
May 22, 2017 20:53
-
-
Save netzvieh/f5d8fb619e9ebdec4cf2c7142f3fe5e7 to your computer and use it in GitHub Desktop.
merging jinja dictionaries
This file contains hidden or 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
{% set opts = {} %} | |
{% set local_opts = {} %} | |
{% set default_opts = { "b": { "c": "d", "d": "e" } } %} | |
{% set special1_opts = { "b": { "c": "f" } } %} | |
{% set special2_opts = { "b": { "d": "g" } } %} | |
{% do opts.update({'foo': default_opts }) %} | |
{% do local_opts.update({'foo': special1_opts }) %} | |
{% do opts.update({'bar': default_opts }) %} | |
{% do local_opts.update({'bar': special2_opts }) %} | |
{% do salt['defaults.merge'](opts, local_opts) %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The goal is
{ "foo": { "b": { "c": "f", "d": "e" } }, "bar": { "b": { "c": "d", "d": "g" } } }