其他的方式可以参考 https://stackoverflow.com/questions/42186301/ansible-create-multiple-folders-if-dont-exist/42188275
# 不需要检查文件是否存在,这个操作是幂等的
- name: create directory if they don't exist
file:
path: "{{ path }}"
state: directory
owner: root
group: root
mode: 0775
loop:
- /data/directory
- /data/another
loop_control:
loop_var: path