Reputation: 27806
I would like to update the pillar data in a custom module.
Background: I would like to set some default values.
This would make the code in jinja simpler, since I could use one place to create defaults (in custom module) and N conditionless usages of the pillar data (in jinja).
For example, up to now the code looks like this (at several places):
{% if pillar.database_replication|default(False) %}
I would like to set the default in a custom module.
Then this would be enough:
{% if pillar.database_replication %}
My goal is to make sls files simpler.
I use salt version 2019.2.0.
Upvotes: 0
Views: 287
Reputation: 883
I think what you can do is have a 'defaults' pillar file, which is loaded before all others.
Something like this in pillar top.sls
base:
'*':
- defaults
# rest of pillar to load
Then you can have in defaults.sls
# default pillars for all minions
database_replication: False
Then:
Upvotes: 1