Refer to the exhibit. The playbook fails with an error. What is the most likely cause?
Exhibit
- hosts: all
tasks:
- name: Import tasks
import_tasks: "{{ item }}.yml"
loop:
- setup
- configureTrap 1: import_tasks must be placed in a role.
import_tasks can be used in tasks section of playbooks.
Trap 2: The loop variable should be referenced as '{{ item }}' without…
The syntax is correct; quotes are needed.
Trap 3: The file names must be literal without templates.
Templates in file names are allowed with include_tasks, but import_tasks cannot use loops at all.
- A
import_tasks cannot be used with a loop.
import_tasks is static and loops are only supported with include_tasks.
- B
import_tasks must be placed in a role.
Why wrong: import_tasks can be used in tasks section of playbooks.
- C
The loop variable should be referenced as '{{ item }}' without quotes.
Why wrong: The syntax is correct; quotes are needed.
- D
The file names must be literal without templates.
Why wrong: Templates in file names are allowed with include_tasks, but import_tasks cannot use loops at all.