Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Use modules in requisites #51604

Closed
Oloremo opened this issue Feb 12, 2019 · 3 comments
Closed

[Feature Request] Use modules in requisites #51604

Oloremo opened this issue Feb 12, 2019 · 3 comments
Labels
Feature new functionality including changes to functionality and code refactors, etc.
Milestone

Comments

@Oloremo
Copy link
Contributor

Oloremo commented Feb 12, 2019

Description of Issue/Question

Saltstack is historically and by design is not about working with runtime information. One of the features that'd like to see is a requisite which are based on some runtime info.

Here is an example:
I want to run some state but only if the result of the different module is True.

It may look like this:

cmd.run:
  <...>
  - onlyif:  my_custom_module_which_returns_true_or_false

And I want to do it in runtime, not before via Jinja execution of the Salt.

I think it's already possible with slots and onlyif in a way that if slots function will return a string "true" or "false", onlyif will execute it on the system and make a decision based on this.

The executing a shell part is really not necessary and this whole approach is hacky so if we may have a new requisite module just for this that'd be really great.

This idea is inspired by Ansible's condition engine, which allows doing this:

name: Run command
command: "ls -1 /tmp"
register: result_of_command

name: Do something if you should
when: "'file123' in result_of_command.stdout_lines"
module_name:
<...>
@Ch3LL
Copy link
Contributor

Ch3LL commented Feb 13, 2019

will approve as a feature request. thanks :)

@Ch3LL Ch3LL modified the milestones: fea, Approved Feb 13, 2019
@Ch3LL Ch3LL added the Feature new functionality including changes to functionality and code refactors, etc. label Feb 13, 2019
@Ch3LL Ch3LL modified the milestones: Approved, fea Feb 13, 2019
@gtmanfred
Copy link
Contributor

This is a duplicate of #5050

And i am working on implementing it right now.

@gtmanfred
Copy link
Contributor

PR #51846

@Ch3LL Ch3LL closed this as completed Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature new functionality including changes to functionality and code refactors, etc.
Projects
None yet
Development

No branches or pull requests

3 participants