我正在Debian Buster上运行ansible-playbook
版本2.7.6 + dfsg-1。我有一本包含另一本的剧本,就像这样:
---
- hosts: "{{ target }}"
tasks:
- include_tasks: set-timezone.yaml
包含的set-timezone.yaml
的内容如下:
---
- hosts: all
tasks:
- name: set timezone to MST
timezone:
name: America/Denver
运行剧本时,出现错误告诉我:
no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/etc/ansible/playbooks/set-timezone.yaml': line 2, column 3, but maybe elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- hosts: all
^ here
我看到了一个类似的问题,问问者拼写了模块的名称,但是我很确定“时区”的拼写正确,并且该模块的版本为official docs,为2.7。我尝试从hosts: all
中删除set-timezone.yaml
,但收到此错误:“包含的任务文件必须包含任务列表”。
答案 0 :(得分:0)
并显示以下错误:“包含的任务文件必须包含任务列表”。
正确的“任务列表”部分的确切含义是:由本身就是可完成任务的项目组成的Yaml列表:
# cat set-timezone.yaml
---
- name: this is a task
debug: msg="hello, world"
- name: set timezone to MST
timezone:
name: America/Denver