Ansible - 使用 "include" 和 "include_tasks" 模块

Ansible - using "include" and "include_tasks" modules

我已经下载了 docker role,当我成为 运行 角色时,我收到以下错误:

The error appears to have been in '/some_folder/geerlingguy.docker/tasks/main.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- include_tasks: setup-RedHat.yml
  ^ here

并且当我用 include 模块替换模块 include_task 模块时,一切都按预期工作。

是什么导致了这个问题?

如果您使用的 Ansible 版本低于 2.4,那么可以预期,因为 include_task 是在 Ansible 2.4 中引入的 https://docs.ansible.com/ansible/2.4/include_tasks_module.html