我在Debian巴斯特运行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
我看到了类似的问题,其中提问者拼写错误的模块的名称,但我敢肯定“时区”拼写正确,并且这个模块是2.7按了official docs。我试图消除hosts: all
从set-timezone.yaml
和得到这个错误,而不是:“包括任务文件必须包含的任务列表”。
而得到这个错误,而不是:“包括任务文件必须包含的任务列表”。
正确的,部分“任务列表”的意思实际上是:由本身是ansible任务物品的清单YAML:
# cat set-timezone.yaml
---
- name: this is a task
debug: msg="hello, world"
- name: set timezone to MST
timezone:
name: America/Denver