saltstack / saltstack/salt

Fetching require data during salt states run, after previous states executed.

Open
#44,778 28 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending-discussion Question
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

HI,
I am writing some salt states into SLS file and encounter a simple common case is that:
In a sls file, if state.2 need state.1 generated data.
such as:

download-pkg:
  cmd.run:
    - name: curl -s -o {{ pkg_pah }} {{ pkg_url }}

{%- set dir_name = salt['cmd.run'](' tar tf ' + pkg_path + ' | sed -e "s@/.*@@" | uniq') %}

other-states:
  need {{ dir_name }} value

other-states need {{ dir_name }} value to continue to execute.
After viewing the following links:
Jinja variables are set before the state will be executed
#12470

Is there any way to fit this case by using salt states or other flexible solutions for this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files or tests; start with the linked discussion about Jinja variables and issue #12470, then inspect how Salt renders SLS templates versus executing states. Done would require an agreed, reproducible way for a later state to consume data produced by an earlier state, with documented validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.