ansible で [DEPRECATION WARNING]: The use of ‘include’ for tasks has been deprecated.
Ansible で playbook を実行したら
1 |
[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. |
roles/common/tasks/main.yml
に他の task を include していたのですが、ここを書き換える必要がありそうです。
メッセージによると
1 |
Use 'import_tasks' for static inclusions or 'include_tasks' for dynamic inclusions. |
とのことなので、ここは import_tasks で置き換えます。
static と dynamic の違いは、最初に読み込まれて解析されるか、実行時にその行まで来たら読み込まれるかの違いになります。
基本的には 文法エラーを最初に検知できるよう、 static inclusion である import_tasks を使うのが良さそうです。
1 2 3 |
- include: init.yml ↓ このように書き換える - import_tasks: init.yml |
これで playbook を実行したときに include の警告は出なくなります。