Ansibleはcheck modeだとshellやcommandは実行されない
最近は深刻なjinja2とAnsible疲れです。
TASK: [ruby | check ruby rbenv installed] ************************************* skipping: [192.0.2.100] ok: [192.0.2.100] => {"msg": "check mode not supported for command", "skipped": true} TASK: [ruby | rbenv install {{ ruby_version }}] ******************************* fatal: [192.0.2.100] => error while evaluating conditional: ruby_installed.find(2.1.4) FATAL: all hosts have already failed -- aborting
こんなエラーが出た。
dry runではshell
やcommand
はskipされるとのことなので
- name: check ruby rbenv installed shell: cd; bash -lc "rbenv versions | grep {{ ruby_version }} | tr '*' ' ' | sed -e 's/\s\+//' | cut -f1 -d' '" register: ruby_installed always_run: yes ignore_errors: yes tags: - ruby - ruby:install - install
のようにalways_run: yes
にしなければならない。
自分メモ。