Ansible 我只是试着写一个剧本,每个剧本都有相同的错误

Ansible 我只是试着写一个剧本,每个剧本都有相同的错误,ansible,Ansible,我认为是任务:(复数),而不是任务:修改你的问题,因为它不可读。并使用任务代替任务。 --- # this is first playbook with handler - host: demo user: ansible become: yes connection: ssh vars: pkgname: httpd task: - name: install httpd service action: yum

我认为是
任务:
(复数),而不是
任务:

修改你的问题,因为它不可读。并使用
任务
代替
任务
--- # this is first playbook with handler
- host: demo
  user: ansible
  become: yes
  connection: ssh
  vars:
          pkgname: httpd
  task:
          - name: install httpd service
            action: yum name='{{pkgname}}' state=installed
            notify: restart httpd
  handler:
          - name: restart httpd
            action: service name=httpd state=restarted
ERROR! 'task' is not a valid attribute for a Play

The error appears to be in '/home/ansible/handler.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

--- # this is first playbook with handler
- host: demo
  ^ here