我想知道是否可以在vars文件中使用Jinja2 {%if%}表达式?
所以说我有
The term 'Connect-VIServer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
基本上,我试图避免每次都设置这些变量,因为它们始终基于az。
谢谢。
答案 0 :(得分:1)
这是无效的语法。首先必须将vars文件解析为YAML文档,并引入Jinja语法导致某些内容不再有效的YAML。
您可以改为执行以下操作:
az:
az1: foo
az2: bar
az3: foobar
floating_ip_pool: "{% if target_az == az['az1'] %}bar{% endif %}"