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
输出,但没有成功提取其中没有文件的项目(目录)。