次のような警告が出るようになりました。
TASK [ruby-sw : Install Ruby via rbenv] ****************************************
[WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: "{{ ruby_version }}" not in
installed_ruby_versions.stdout
コードの修正
警告のもととなったコード
{{ ruby_version }}は別の変数を定義するファイル all に、ruby_version: 2.3.4などとして定義
- name: Install Ruby via rbenv
shell: bash -lc "rbenv install {{ ruby_version }}"
when: '"{{ ruby_version }}" not in installed_ruby_versions.stdout'
これを、次のように変更したところ、警告は出なくなりましたの!
- name: Install Ruby via rbenv
shell: bash -lc "rbenv install {{ ruby_version }}"
when: ruby_version not in installed_ruby_versions.stdout
調査したこと
を見ると、今回の警告は、予期したもので意図通りの動き、Ansible 2.3 からこのようにした、とのことでしたわ♪
This is expected. The warning was recently added to the 2.3 release purposefully.
As the warning states, you should not use jinja2 delimiters in a when statement. Instead it should read:
when: ansible_PSVersionTable.Major|int < 5
If you have further questions please feel free to use the mailing list.
おわりに
今までの書き方が、あっという間に古くなりますのね。。。
ついていくのが大変ですけれども、バージョンアップが頻繁に行われ、頼もしくもありますわ♪
なお、作成したプレイブックはこちらですの♪
以上です。
