地方エンジニアの学習日記

興味ある技術の雑なメモだったりを書いてくブログ。たまに日記とガジェット紹介。

【Ansible】: Invoking "yum" only once while using a loop via squash_actions is deprecated.

Ansibleの警告文をまじまじと見てたら見つけた警告文。シンタックス的には問題ないし動作も大丈夫だよって場合にエラーにならずにログに出てるようだ。

[DEPRECATION WARNING]: Invoking "yum" only once while using a loop via 
squash_actions is deprecated. Instead of using a loop to supply multiple items 
and specifying `name: {{ item }}`, please use `name: ['git', 'gcc']` and remove
 the loop. This feature will be removed in version 2.11. Deprecation warnings 
can be disabled by setting deprecation_warnings=False in ansible.cfg.

Ansible Configuration Settings — Ansible Documentation

モジュール的にはwith_itemとか使わないでyamlのリストで値をよこせ的なイメージの警告らしい。ansibleが内部的にリストに変換してくれるけど2.11あたりからやらないよ?的な感じ?

解決方法

with_items -> listでパラメータを渡してあげるように修正すれば問題ない。