python - Saltstack variables -


I have questions about variables in salt if I use the statement to make a more complex state with salt I am trying to

Examples of work:

  {% old_stable set = salt ['CMD.ron'] ('cd / home / project_name & amp; ls-tt | Grep 2 | GRP-V tar.gz | tail-n +2 | head-n1 ')%} {% set time_data = salt [' cmdan '] (' ls -lt / home / project_name / | wc- L ') == 2% (' Date +% Y% m% d% H% M ')%} {% salt [' cmd.run ']} & lt; State & gt; {% Endif%}  

So, the question is whether I define to put "/ home / project_name /" such as {{old_stable}} at the top of the file at the peak

Example (if not working)

Example (not working)

  {% set project = '/ Home / project_name'%} {% if salt ['CMD.'] ('LS-LT {{project}}') | Wc -l ') == 2%} & lt; State & gt; {% Endif%}  

My code is

  {% set project = 'test_web_tool'%} {% if salt ['cmd.run'] ('LS-LT / Home / Project-User / Project2 & gt; / dev / null | wc -l')! = "0"%} Output: cmd.run: - Name: - "echo" rollback directory {{project}} "- cwd: / root {% else%} error_output: cmd.run: - name: - echo" this Delete the previous directory. "- cwd: / root {% endif%}  

You may want to use two wires to include:

  {% set project = '/ home / project_name'%} {salt ['CMD'] '(' LS -LT '~ Project ~' | wc -l ') == 2%} 
State & gt; {Endiff%}

Comments