ANSIBLE无法正常工作 - 语法检查
我正试图在我的第一本剧本上进行设置。 Hovever ......不管我试图测试哪些例子..我收到类似的错误:ANSIBLE无法正常工作 - 语法检查" title="语法检查">语法检查
"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
的哪些错误?
PS。
$ ansible --version ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/pi/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170124]
回答:
请参阅Playbooks Intro文档。 您的输入应该是task
项目。
--- - hosts: ...
tasks:
- name: Update and upgrade
become: true
apt:
upgrade: yes
update_cache: yes
以上是 ANSIBLE无法正常工作 - 语法检查 的全部内容, 来源链接: utcz.com/qa/257849.html