I have the case where I have 3 salt states A.sls, B.sls and C.sls of which only one will be applied on a host.
All 3 of them sets a jinja variable x to a specific value and then I want all 3 to call a mutual salt state D.sls which makes use of x.
How do I do this? I tried using include: D.sls
but it is executed before I can set variable.
Saltstack: Pass jinja variable from a salt state file to an included salt state
saltstack
Related Topic
- Saltstack configuration “No Top file or external nodes data matches found”
- Reason to store a SSH private key in a Salt Pillar instead of a file as part of a State
- Salt-Stack copy directory from salt master to minion
- Saltstack Accessing pillar inside salt[‘cmd.run’]
- Select a Salt top file when using saltenv with a gitfs backend
Best Answer
The trick was not to use the Salt "include" directive, but the jinja include as shown in this answer: Passing variables with include in salt-stack