我想用下面的任務在一個劇本:如何在'with_first_found'中使用'skip:true'?
- include: "{{ prerequisites_file }}"
with_first_found:
- "prerequisites-{{ ansible_distribution }}.yml"
- "prerequisites-{{ ansible_os_family }}.yml"
loop_control:
loop_var: prerequisites_file
我想它只是傳遞如果沒有找到相匹配的架構文件。
在運行時由於是,在這種情況下,它會產生一個錯誤:
TASK [ansible-playbook : include] ***************************************
fatal: [ansible-playbook]: FAILED! => {"failed": true, "msg": "No file was found when using with_first_found. Use the 'skip: true' option to allow this task to be skipped if no files are found"}
我知道我可以在末尾添加一個虛擬文件,但如果我照做,我怎麼應該在這裏添加skip: true
選項?
這絕對不是include
模塊的參數,它應該得到某種必然with_first_found
條款...