我继承了一个类似剧本的文件,thing.yaml
其中包含以下内容:
---
- include: one.yaml
- include: two.yaml
ansible-playbook
我通常使用one.yaml
and启动 yaml 文件two.yaml
,但thing.yaml
被拒绝:
ERROR! 'include' is not a valid attribute for a Play
The error appears to be in '.../thing.yaml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- include: one.yaml
^ here
哪个命令行会吃掉包含这样的文件?
你要找的是
include_tasks
,不是include
。请参阅https://docs.ansible.com/ansible/2.8/modules/include_tasks_module.html该模块在2.16 版本
include
中已被弃用,因为ansible
来源:Ansible 文档
替代方案是
include_tasks
、import_tasks
和import_playbook
。(我个人的猜测也是include_role
如此,但没有列出。)