我不知道为什么加载Yaml时会出现语法错误

时间:2019-04-15 10:34:34

标签: ansible

我想使用以下几行来更新剧本中的所有软件包,

---
- name: First play

  hosts: all

  tasks:

     - name: Update all the current software packages on the system

       yum: name=* state=latest

但是我一直收到错误消息,说语法有问题。

The offending line appears to be:
- name: Update all the current software packages on the system
   yum: name=* state=latest
      ^ here

1 个答案:

答案 0 :(得分:0)

您的“ yum”之前没有正确的附加空间,并且“-name”需要与任务保持一致。试试这个:

---
- name: First play
  hosts: all

  tasks:
  - name: Update all the current software packages on the system
    yum:
      name: *
      state: latest