我已将ansible升级到v2.6.2。升级后,不再接受来自vars_prompt的主机的ansible变量。
---
- hosts: "{{ hosts }}"
vars_prompt:
- name: "hosts"
private: no
tasks:
- name: touch file
command: touch /home/tomcat/a
我遇到了错误
ERROR! The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'hosts' is undefined
The error appears to have been in '/home/tomcat/test.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- hosts: "{{ hosts }}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
对此有何建议?