If statement ansible中变量中的条件文本
H我想用ansible生成一条警告消息,该消息存储在一个变量中: 我有{{total}}和{{want}},我想将其存储在{{output}变量中: 我需要像这样的东西: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}
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%}