我只是想写一个基本的剧本,并不断收到下面的错误。
尝试了很多东西但仍然无法做到正确。我知道这一定是语法问题,但不知道在哪里。
这是我的代码:
---
# This playbook runs a basic DF command.
- hosts: nagios
#remote_user: root
tasks:
- name: find disk space available.
command: df -hPT
这是我得到的错误:
> 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
Ansible 版本:2.4.2.0
这让我发疯。我查看了 Ansible 文档中的一些示例,看起来是一样的。
不知道...
有人知道吗?
问题是,如果没有命令行缩进,命令指令就是整个游戏的一部分,而不是任务块。
i.e. 该命令应该是任务块的一部分.
---
# This playbook runs a basic DF command.
- hosts: nagios
#remote_user: root
tasks:
- name: find disk space available.
command: df -hPT
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)