官網:http://docs.ansible.com/ansible/latest/stat_module.html#synopsis
用途:檢查文件或文件系統的狀態
注意:
對于Windows目標,請改用win_stat模塊
選項:
path:文件/對象的完整路徑(必須)
案例:
- name: install_apcu | Check if apcu local file is already configured.
stat: path={{ php_apcu_file_path }}
connection: local
register: php_apcu_file_result
常用的返回值判斷:
exists: 判斷是否存在
isuid: 調用用戶的ID與所有者ID是否匹配
- 第一章:Ansible基礎入門
- 第二章:Ansible系列手冊
- 第一節:Ansible系列之主機清單
- 第二節:Ansible系列之變量
- 第三節:Ansible系列之YAML
- 第四節:Ansible系列之條件判斷
- 第五節:Ansible系列之循環
- 第六節: Ansible系列之tags
- 第七節:Ansible系列之Jinja2
- 第三章:Ansible系列之模塊
- 第一節:user模塊
- 第二節:group模塊
- 第三節:cron模塊
- 第四節:copy模塊
- 第五節: file模塊
- 第六節:yum模塊
- 第七節:service模塊
- 第八節:shell模塊
- 第九節:script模塊
- 第十節:setup模塊
- 第十一節:filesystem和mount模塊
- 第十二節:synchronize模塊
- 第十三節: get_url模塊
- 第十四節: package模塊
- 第十五節:stat模塊
- 第十六節:unarchive模塊
- 第十七節: commang模塊
- 第四章:Ansible-playbook介紹
- 第五章:Ansible系統環境
- 第一節:Ansible Role 系統環境之epel設置