ユーザ用ツール

サイト用ツール


serverapps:configmgmt:ansible:ansibletips

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
最新のリビジョン両方とも次のリビジョン
serverapps:configmgmt:ansible:ansibletips [2017/04/14 05:21] – 外部編集 127.0.0.1serverapps:configmgmt:ansible:ansibletips [2020/01/28 01:58] hayashi
行 1: 行 1:
 ====== AnsibleのTips ====== ====== AnsibleのTips ======
  
 +===== DryRun時にスキップ =====
 +スキップしたいTASKに以下の条件を付与する
 +
 +  when: not ansible_check_mode
  
 ===== json形式のstdoutを利用する ===== ===== json形式のstdoutを利用する =====
行 72: 行 76:
 # task # task
 - stat: path=/path/to/anyfile - stat: path=/path/to/anyfile
-  register: is_exist+  register: checked_file
  
 - name: skip if file is found. - name: skip if file is found.
   fail: msg='file not found'   fail: msg='file not found'
-  when: is_exist.stat.md5 is not defined+  when: checked_file.stat.md5 is not defined 
 + 
 +## OR 
 + 
 +- name: skip if file is found. 
 +  fail: msg='file not found' 
 +  when: not checked_file.stat.exists 
 </code> </code>
  
serverapps/configmgmt/ansible/ansibletips.txt · 最終更新: 2020/01/28 02:33 by hayashi