当我执行一个剧本时,我得到了以下错误:
➜ ansible ansible-playbook site.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! A malformed role declaration was encountered.
The error appears to be in '/Users/channa/random_poc/ansible/site.yml': line 2, column 4, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: "Play 1"
^ here
我查阅了一些网上的例子,并尝试修改我自己的剧本site.xml
。但是,似乎什么都没有解决,我总是犯同样的错误。
这是我的剧本site.xml
:
---
- name: "Play 1"
hosts: localhost
roles:
— myuser
有人能解释一下我做错了什么吗?
您的"-";性格
以下工作:
---
- name: "Play 1"
hosts: localhost
roles:
- myuser
注意以下两者之间的差异:
— myuser
和
- myuser
如β.εηιτ.βε所示,用执行
ansible-playbook /path/to/playbook