0
我有一個這樣的劇本:Ansible |創建符號鏈接,如果目錄爲空
---
- hosts: all
tasks:
- name: Create 404 link
file:
dest: /var/www/html/{{ item }}/images/index.html
src: /var/www/html/404.html
state: link
with_items:
- a
- b
- c
- d
- e
# when: ???
...
現在的任務應該只運行如果/var/www/html/{{ item }}/images
目錄是空的。我如何完成這項工作?我試過使用find
模塊和register
輸出,但沒有成功提取其中沒有文件的項目(目錄)。