Ansible 实用代码总结
变量打印
1 2 3 4 5 6 7 8 9
| - name: Check ImageMagick source dir exists stat: path: /tmp/ImageMagick-{{ ImageMagick_version }} changed_when: false register: result_stat_imagemagick_source_dir
- debug: var: result_stat_imagemagick_source_dir verbosity: 0
|
目录、文件存在判断
https://stackoverrun.com/cn/q/9829335
1 2 3 4 5 6 7 8 9 10
| - name: Check ImageMagick source dir exists stat: path: /tmp/ImageMagick-{{ ImageMagick_version }} changed_when: false register: result_stat_imagemagick_source_dir
- name: Copy and unarchive ImageMagick source code zip file. unarchive: src="ImageMagick-{{ ImageMagick_version }}.tar.gz" dest=/tmp copy=yes mode=0755 when: - result_stat_imagemagick_source_dir.stat.exists == false
|