Ansible file module

 

state : absent, directory, file, hard, link, touch

 

  1. Change File Attributes
    ansible all -m file -a 'path=/root/bb owner=laconic group=laconic mode=7777'

     

  2. Create Hard & Symbolic Link & Remove
    ansible all -m file -a 'path=/root/laconic force=yes state=link | hard | absent'

     

  3. Create Directories
    ansible all -m file -a 'path=/a/b/c state=directory'

     

  4. Create File
    ansible all -m file -a 'path=/root/bb/cc state=touch mode=7777'  # /root/bb must exists

     

  5. Recurse
    ansible all -m file -a 'path=/tmp owner=root group=root mode=7777 recurse=yes'

     

posted @ 2021-12-03 16:22  ascertain  阅读(87)  评论(0编辑  收藏  举报