如何使用 jinja2 在 Ansible 中加入引号?
问题描述:
我有一个 ansible 列表值:
I have an ansible list value:
hosts = ["site1", "site2", "site3"]
如果我试试这个:
hosts | join(", ")
我明白了:
site1, site2, site3
但我想得到:
"site1", "site2", "site3"
答
为什么不简单地加上引号?
Why not simply join it with the quotes?
"{{ hosts | join('", "') }}"