I have a file ansible/group_vars/test_dir/whitelist.yml
which contains:
list:
[item1, item2, item3]
How can I have this list in a YAML style? like:
list:
- item1
- item2
- item3
As a solution. I managed to create a template:
my_list:
{% for item_of_interest in curl_command.result %}
- {{item_of_interest.attribute}}
{% endfor %}
the curl_command.result is actually a variable that I register in the task where I want to make use of this list... but for now, this did it for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.