I have a simple playbook and I want to enter the host interactively. My code looks like:
- hosts: "{{my_hosts}}"
vars_prompt:
- name: "my_hosts"
prompt: "Enter the hosts"
private: no
This code works fine in 2.3 and 2.4, but in 2.5 I get the message below. I haven't seen anything in the release notes that would explain why it stopped working. Anyone knows why?
Thanks,
a
ERROR! The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'scraper_hosts' is undefined
The error appears to have been in 'my-playbook.yml': line 8, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- hosts: "{{my_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 }}"