Skip to content

Allow orchestrate to call orchestration files #33390

@ealphonse

Description

@ealphonse

Description of Issue/Question

I have a use-case that requires calling orchestration files within state.orchestrate.

I am developing a continuous deployment pipeline in salt: I have the same
orchestration file used to deploy at various stages + rollback if needed. It is
like a procedure which args are pillar data.

The stages are dealt with another orchestration file, and if deployment
fails (onfail) I rollback to the lastest working version. Salt orchestration
is powerful to script setups like that.

The documentation hints toward using module.run: - name: saltutil.runner - _fun: state.orchestrate or salt.runner: - name: state.orchestrate but it is not working as expected.

I filled in issue #33388 but a bigger problem is that this nested call does not
pass the return value. The root cause seems to be that saltstack does not
support calling orchestrate from orchestrate.

As discussed with @whiteinge, allowing it could bring more expressive power to
salt, and by gathering new data between each orchestration file call, one
could deal with the limitation that the whole tree must be compiled at the top of
the run. Note that the include directive does not help here.

With this feature, it is very easy to visualize and implement a continuous
deployment pipeline in salt (maybe with the handling of issue #28682 too).

I guess it is general enough to bring more power to other use-cases as well.

To summarize, calling orchestration files with orchestrate would allow to implement procedures in salt and get their benefits:

  • reusing code
  • gathering new data during execution to act on (new context)
  • bringing more expressive power and less relying on external tools.

If you think it would be a helpful addition, my 2 cents would be to define a new saltmod function to directly call an orchestration file. This function would accept pillar and saltenv args. In doing so, it would be easy to understand from the doc, and also would allow to output a readable execution trace.

Thank you in advance for your thoughts on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Corerelates to code central or existential to SaltFeaturenew functionality including changes to functionality and code refactors, etc.State-CompilerState-Modulestale

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions