我只是想写一个基本的剧本,并不断收到下面的错误。尝试了一吨的东西,但仍然无法解决问题。我知道这一定是语法问题,但不知道在哪里。
这是我的代码:
---
# This playbook runs a basic DF command.
- hosts: nagios
#remote_user: root
tasks:
- name: find disk space available.
command: df -hPT
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
> ERROR! 'command' is not a valid attribute for a Play
>
> The error appears to have been in '/root/playbooks/df.yml': line 4,
> column 3, but may be elsewhere in the file depending on the exact
> syntax problem.
>
> The offending line appears to be:
>
>
> - hosts: nagios
^ here
Run Code Online (Sandbox Code Playgroud)
Ansible版本:2.4.2.0
它让我发疯。我看过Ansible文档中的一些示例,它看起来相同。不知道...
有人知道吗
Jes*_*sse 11
问题是没有命令行的缩进,命令指令是整个过程的一部分,而不是任务块。即命令应该是任务块的一部分。
---
# This playbook runs a basic DF command.
- hosts: nagios
#remote_user: root
tasks:
- name: find disk space available.
command: df -hPT
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
36398 次 |
| 最近记录: |