【发布时间】:2023-03-12 17:05:01
【问题描述】:
my_tags 事实分配正在第二个分配中工作。列出的第一个分配导致失败,但这只是一个简单的重新排列。是的,我在运行它时正确地注释/取消了注释。
代码如下:
- name: Set optional tag
when: machine_type.find('substr') != -1
set_fact:
# vvv some quoting error? vvv
my_tags: {{ my_tags | default('') }}, sbc_type:{{ direction }},
# vvv works just fine vvv
#my_tags: sbc_type:{{ direction }}, {{ my_tags | default('') }}
这是错误:
my_tags: {{ my_tags | default('') }}, sbc_type:{{ direction }},
^
We could be wrong, but this one looks like it might be an issue with
missing quotes.
当我从终端复制粘贴到此处时,如果有任何线索,克拉 (^) 指向“方向”变量,但我没有看到正在使用任何选项卡。
为什么重排会导致这个错误?
【问题讨论】:
-
尝试
" "引用{{ }}的第一组或第二组或两者。
标签: yaml ansible ansible-playbook