### [file模塊][1]
用于設定或修改文件的屬性信息
~~~
group:默認為空
owner:默認為空
path:默認為空,別名:'dest', `name'
recurse:yes, no 默認為no
src:創建連接文件時有用
~~~
~~~
state:file, link, directory, hard, touch, absent
file 默認屬性,如果文件不存在則不創建,并且報錯,用于修改已存在文件的屬性
directory 如果目錄不存在,則創建目錄和子目錄
absent 遞歸刪除文件或目錄
link 在創建軟鏈接是有用
hard 創建硬鏈接
~~~
### 示例
~~~
---
- name: file
hosts: local
tasks:
- name: file
file:
src: '/tmp/{{ item.src }}'
dest: '{{ item.dest }}'
state: link
with_items:
- { src: 'x', dest: 'y' }
- { src: 'z', dest: 'k' }
~~~
[1]:http://docs.ansible.com/ansible/file_module.html
- 目錄
- ansible基礎
- ansible簡介
- ansible安裝和測試
- ansible配置文件
- 常用命令
- yaml在ansible中的用法
- inventory
- 變量與facts
- when語句
- handler模塊
- 大雜燴
- ansible模塊
- assert 模塊
- copy模塊
- cron模塊
- debug模塊
- django_manage模塊
- file模塊
- filesystem模塊
- git模塊
- hostname模塊
- lineinfile模塊
- mount模塊
- mysql_user模塊
- mysql_db模塊
- pip模塊
- selinux
- setup模塊
- shell 和 command 模塊
- stat模塊
- supervisorctl
- systemd
- timezone
- unarchive模塊
- user模塊
- wait_for
- yum和service模塊
- 其他模塊或者方法
- setup模塊
- url模塊
- slack 模塊
- pause 模塊
- 其他
- 報錯處理
- playbooks
- 復雜的playbook
- 循環
- roles
- YAML
- jinja2