美文网首页Ansibleansible应用合集
Ansible文件操作 file模块(学习笔记三)

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

作者: SkTj | 来源:发表于2018-03-22 14:43 被阅读6次

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模块(学习笔记三)

    本文链接:https://www.haomeiwen.com/subject/pgsaqftx.html