ANSIBLE不';t工作-语法检查
我正试着在我的第一本剧本上设置ansible。 霍夫。。。不管我想测试哪个例子。。我收到了类似的错误:ANSIBLE不';t工作-语法检查,ansible,yaml,Ansible,Yaml,我正试着在我的第一本剧本上设置ansible。 霍夫。。。不管我想测试哪个例子。。我收到了类似的错误: "xyz is not a valid attribute for a Play" 例如: $ cat a2.yml - name: Update and upgrade become: true apt: upgrade: yes update_cache: yes $ ansible-playbook a2.yml --syntax-check ERROR!
"xyz is not a valid attribute for a Play"
例如:
$ cat a2.yml
- name: Update and upgrade
become: true
apt:
upgrade: yes
update_cache: yes
$ ansible-playbook a2.yml --syntax-check
ERROR! 'apt' is not a valid attribute for a Play
The error appears to have been in '/home/pi/My/ansible/a2.yml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Update and upgrade
^ here
怎么了
附言
见文件。
您的条目应该是任务
项
---
- hosts: ...
tasks:
- name: Update and upgrade
become: true
apt:
upgrade: yes
update_cache: yes
可能重复的工程;-)我没有意识到“任务”是强制性的。(整个概念对我来说有点不清楚)。谢谢你的帮助。
---
- hosts: ...
tasks:
- name: Update and upgrade
become: true
apt:
upgrade: yes
update_cache: yes