Ansible file module
state : absent, directory, file, hard, link, touch
- Change File Attributes
ansible all -m file -a 'path=/root/bb owner=laconic group=laconic mode=7777'
- Create Hard & Symbolic Link & Remove
ansible all -m file -a 'path=/root/laconic force=yes state=link | hard | absent'
- Create Directories
ansible all -m file -a 'path=/a/b/c state=directory'
- Create File
ansible all -m file -a 'path=/root/bb/cc state=touch mode=7777' # /root/bb must exists
- Recurse
ansible all -m file -a 'path=/tmp owner=root group=root mode=7777 recurse=yes'