使用ansible的同学都知道,ansible只支持新增删除具体的某个文件夹或者文件,如下所示: 1. 创建目录,删除整个目录 - name: Create a directory if it does not exist file: path: /appvol/some_directory state: directory mode: '0755' - name: Remove a directory if it exist file: path: /appvol/some_directory