I'm sure this has been asked many many times (first page on Google provides already a couple of references). But I couldn't see an option to ignore missing pillars when running the state.
When retrieving the pillar, you can see the error, but the execution itself doesn't fail:
$ sudo salt edge01.bjm01 pillar.items
edge01.bjm01:
----------
_errors:
- Specified SLS 'edge01_bjm01.acl' in environment 'base' is not available on the salt master
- Specified SLS 'edge01_bjm01.bgp' in environment 'base' is not available on the salt master
- Specified SLS 'edge01_bjm01.probes' in environment 'base' is not available on the salt master
- Specified SLS 'edge01_bjm01.prefixlist' in environment 'base' is not available on the salt master
But running a state, it fails:
$ sudo salt edge01.bjm01 state.sls ntp
edge01.bjm01:
Data failed to compile:
----------
Pillar failed to render with the following messages:
----------
Specified SLS 'edge01_bjm01.acl' in environment 'base' is not available on the salt master
----------
Specified SLS 'edge01_bjm01.bgp' in environment 'base' is not available on the salt master
----------
Specified SLS 'edge01_bjm01.probes' in environment 'base' is not available on the salt master
----------
Specified SLS 'edge01_bjm01.prefixlist' in environment 'base' is not available on the salt master
I was wondering if there would be any reasoning against adding an option, e.g. ignore_missing_pillar_on_highstate
defaulting to False
?
Thanks!
@mirceaulinic I think what you want is the jinja option - ignore_missing: True
added to your pillar top.sls file.
Ooh, that's very nice. I've searched for this and now I see it, it looks like just what I need. Thanks a lot @garethgreenaway.
However, as I couldn't find it (or, at least, it wasn't immediately obvious where to look for this option), I am thinking that others may have the same questions. Where would be the right place to document this? It doesn't seem to be explained under https://docs.saltstack.com/en/latest/ref/states/top.html (it is true that is for the state top), nor https://docs.saltstack.com/en/latest/topics/tutorials/pillar.html.
Thanks!
Closing this, confirmed it is working. Thanks @garethgreenaway. Could you please mention what would be the best place to document this?
@mirceaulinic Good question. It's not a Salt specific thing but rather a Jinja thing, perhaps the Understanding Jinja page (https://docs.saltstack.com/en/latest/topics/jinja/index.html).
btw, I had the same error, solved it by refreshing pillar data,
salt * saltutil.refresh_pillar
Most helpful comment
btw, I had the same error, solved it by refreshing pillar data,
salt * saltutil.refresh_pillar