我想创建一个包含 myVar1 的词典 myVar2 和其他条目,如下所示:
myVar1:
entry1: "text1"
entry2: "text2"
myVar2: "{{ myVar1 }}"
additional: "entry"
当我尝试使用此vars文件启动 ansible 时,我收到错误消息:
ERROR! Syntax Error while loading YAML.
我该如何解决?
答案 0 :(得分:1)
使用combine
过滤器:
myVar1:
entry1: "text1"
entry2: "text2"
myVarTmp:
additional: "entry"
myVar2: "{{ myVar1 | combine(myVarTmp) }}"