Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道我可以默认使用一个简单的硬编码字符串,但我正在尝试这样做:
myvar: "{{ lookup('env','var1') | default("{{var2}}",true) }}"
但它将其添加为字符串而不是对其进行评估。
一旦你打开了一个 Jinja2 表达式,{{你就不需要再次打开它(尤其是引用的),你可以通过它们的名字来引用变量:
{{
myvar: "{{ lookup('env','var1') | default(var2, true) }}"