【发布时间】:2017-10-22 09:12:22
【问题描述】:
我确实有这样定义的角色foo:
# roles/foo/tasks/main.yml
---
- name: restart Apache
systemd:
name: apache2
state: restarted
daemon_reload: yes
但是当我启动请求这个角色的剧本时,我得到了这个错误:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/root/roles/foo/tasks/main.yml': line 4, column 12, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: restart Apache
systemd:
^ here
我不明白这里有什么问题,因为我在文档中找到了这样的示例...
(我省略了在这个角色中定义并且运行良好的其他部分)
【问题讨论】: