pass the cmd.run stdout to variable #67887
Replies: 2 comments 1 reply
|
so, for your first question, you use the module cmd.run not the state if it is happening in a state it is already too late to be in the jinja. and please. in the future use markdown to clarify and code like snippets. as for the second question. it already works that way. you need to make sure your if statement is actually true of coarse. |
0 replies
|
one final thing. about the first question. I would look for a module that handles that data cleaner then the cmd.run first. such as the status module or some other module. that might beable to pick up the information. cmd.run in jinja can be messy. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi All,
I need some help in assigning the result (std output) of cmd.run module to a variable in state file and also I need some help in calling a variable from inside of an if condition to out side of it
exp:
test:
cmd.run:
- name: "df -hT"
I want the std out of above to a variable
also I need some help in
{% set node = salt'pillar.get' %}
{% if node == grains.host %}
{% set data = '123 %}
{% endif %}
test_1:
cmd.run:
- name: echo {{ data }}
All reactions