Ansible & with_items 命名
Ansible & with_items naming
我的 Ansible 剧本中需要包含以下内容:
with_items: "{{ ab36-1E }}"
上面的方法在Ansible 2.1 和2.2 版本中不起作用并导致错误。
{"failed": true, "msg": "template error while templating string: unexpected char u'E' at 8. String: {{ab36-1E}}"}
但是,这有效:with_items: "{{ ab361E }}"
{{ab36-1E}}
是在 YAML 文件中定义并在剧本中引用的字典变量。
我想知道是否有办法在 Ansible 的 with_items
中使用 {{ ab36-1E }}
而不是 {{ ab361E }}
。
不,这是不可能的,而且不限于with_items
。
What Makes A Valid Variable Name:
Variable names should be letters, numbers, and underscores. Variables should always start with a letter.
我的 Ansible 剧本中需要包含以下内容:
with_items: "{{ ab36-1E }}"
上面的方法在Ansible 2.1 和2.2 版本中不起作用并导致错误。
{"failed": true, "msg": "template error while templating string: unexpected char u'E' at 8. String: {{ab36-1E}}"}
但是,这有效:with_items: "{{ ab361E }}"
{{ab36-1E}}
是在 YAML 文件中定义并在剧本中引用的字典变量。
我想知道是否有办法在 Ansible 的 with_items
中使用 {{ ab36-1E }}
而不是 {{ ab361E }}
。
不,这是不可能的,而且不限于with_items
。
What Makes A Valid Variable Name:
Variable names should be letters, numbers, and underscores. Variables should always start with a letter.