I have a several pillars and I am trying to merge them in the same jinja variable

{%- import_yaml "server_list_de.yaml" as servers %}
{%- import_yaml "server_list_uk.yaml" as servers_uk %}
{%- servers.update(servers_uk) %}

but I've got following error:

File "/usr/lib/python2.7/dist-packages/salt/utils/context.py", line 211, in __getitem__
return self._dict()[key]
KeyError: '_errors'

1 Answer 1


The "saltey" way of doing this is typically in a map.jinja file. This one for example...

In that, you would:

{%- load_yaml as serverlist %}
#Note that a default list could be provided here
{%- endload %}

{%- set serverlist2 = salt['grains.filter_by'](serverlist, merge=salt['pillar.get']('pillarname:server_list_de')) %}
{%- set servers = salt['grains.filter_by'](serverlist2, merge=salt['pillar.get']('pillarname:server_list_uk')) %}

Then in your sls file you would then put at the top:

{%- from "formulaname/map.jinja" import servers with context %}

Servers should then be available to you. I've never tried merging twice though, so give it a try. At a minimum this may give you some direction as the syntax for doing a pillar merge like this may get you what you are looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.