Ansible文件操作 file模块(学习笔记三)

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"

image.png

3、创建空文件:ansible all -m file -a "path=/root/testtouch.sh state=touch mode=0644"

image.png

4、创建空目录: ansible all -m file -a "path=/root/testdirectory state=directory mode=0644"

image.png

5、删除目录或文件,强制执行:ansible all -m file -a "path=/root/testdirectory state=absent force=yes"

image.png

你可能感兴趣的:(Ansible文件操作 file模块(学习笔记三))