file子產品:修改檔案屬性、生成連結檔案、建立空檔案、建立空目錄、删除目錄檔案
1、修改檔案屬性, ansible all -m file -a "path=/root/test.sh owner=test group=test mode=0644"
image.png
2、生成連結檔案:ansible all -m file -a "src=/root/test.sh dest=/root/testlink.sh owner=root group=root state=link"
3、建立空檔案:ansible all -m file -a "path=/root/testtouch.sh state=touch mode=0644"
4、建立空目錄: ansible all -m file -a "path=/root/testdirectory state=directory mode=0644"
5、删除目錄或檔案,強制執行:ansible all -m file -a "path=/root/testdirectory state=absent force=yes"