ansible判定文件或者文件夹是否存在
2017-11-30 19:18
155 查看
ansible 的常用模块中没有判定当文件存在或者不存在时,执行某个执行
使用下面方法能简单判定某个文件是否存在
另外一种
使用下面方法能简单判定某个文件是否存在
--- - name: judge a file or dir is exits shell: ls /home/sfy ignore_errors: True register: result - shell: echo "file exit" when: result|succeeded - shell: echo "file not exit" when: result|failed
另外一种
#当/root/.ssh/id_rsa文件存在时,则修改该文件权限 - command: chmod 600 /root/.ssh/id_rsa removes=/root/.ssh/id_rsa
相关文章推荐
- C语言判断文件夹或者文件是否存在的方法
- 判断文件或者文件夹是否存在
- find或者test查看某一文件夹下某一文件是否存在
- Python判断文件或者文件夹是否存在
- windows10UWP:如何判断一个文件或者文件夹是否存在?
- C语言判断文件夹或者文件是否存在的方法【转】
- C语言判断文件夹或者文件是否存在的方法
- C语言判断文件夹或者文件是否存在的方法
- [C/C++相关]C语言判断文件夹或者文件是否存在的方法
- shell 判断文件或者文件夹是否存在
- C语言判断文件夹或者文件是否存在的方法
- C语言判断文件夹或者文件是否存在的方法
- 嵌入式 检测一个文件或者文件夹是否存在
- c#---判断文件或者文件夹是否存在
- 如何在shell脚本中判断文件或者文件夹是否存在?
- C语言判断文件夹或者文件是否存在的方法
- 如何在shell脚本中判断文件或者文件夹是否存在?
- 如何判定文件或文件夹是否存在?
- Java 判断文件或者文件夹是否存在并创建新文件或者文件夹
- 如何在shell脚本中判断文件或者文件夹是否存在?