Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement ansible中变量中的条件文本_If Statement_Variables_Ansible - Fatal编程技术网

If statement ansible中变量中的条件文本

If statement ansible中变量中的条件文本,if-statement,variables,ansible,If Statement,Variables,Ansible,H我想用ansible生成一条警告消息,该消息存储在一个变量中: 我有{{total}}和{{want}},我想将其存储在{{output}变量中: 我需要像这样的东西: if ({{total}} < {{wanted}}): {{outcome}}= "you need to much" else if ({{total}} = {{wanted}}): {{outcome}}= "Could work out" else: {{outcome}}= "Ok" if({{total}

H我想用ansible生成一条警告消息,该消息存储在一个变量中:

我有{{total}}和{{want}},我想将其存储在{{output}变量中:

我需要像这样的东西:

if ({{total}} < {{wanted}}): {{outcome}}= "you need to much"
else if ({{total}} = {{wanted}}): {{outcome}}= "Could work out"
else: {{outcome}}= "Ok"
if({{total}}<{{wanted}}):{{{output}=“你需要更多”
如果({{total}}={{wanted}}}):{{output}}=“可以解决”
else:{{output}}=“Ok”
我怎样才能让它工作


谢谢你的建议。。。这让我快发疯了

下面的任务完成了任务

- set_fact:
    outcome: |
      {% if total|int < wanted|int %}
      You need to much
      {% elif total|int == wanted|int %}
      Could work out
      {% else %}
      Ok
      {% endif %}
-设置事实:
结果:|
{如果总数| int<通缉| int%}为%
你需要做很多
{%elif total | int==通缉犯| int%}
可以解决
{%else%}
好啊
{%endif%}