Ansible yaml语法失败

use*_*A__ 1 ansible ansible-playbook

我有一个关于ansible的yaml文件

  # role: common
  # # common tasks
  # ---
    # #
  # # create default mariadb Audit db users
  # #
 -name: common | setup impactGroup group
 group: name=group system=no gid=510
 ignore_errors: yes
~ 
Run Code Online (Sandbox Code Playgroud)

我还在库存文件中定义了正确的服务器列表

当我执行ansible-playbook命令时,我得到以下错误

  /usr/bin/ansible-playbook -D /tmp/eabinay/test.yml -i /tmp/eabinay/dbServerInventory
  ERROR: parse error: playbooks must be formatted as a YAML list, got <type 'dict'>
Run Code Online (Sandbox Code Playgroud)

mon*_*lls 7

审查缩进.这段代码对我有用.

- name: common | setup impactGroup group
  group: name=group system=no gid=510
  ignore_errors: yes
Run Code Online (Sandbox Code Playgroud)

首先检查--syntax-check选项:

/usr/bin/ansible-playbook -D /tmp/eabinay/test.yml -i /tmp/eabinay/dbServerInventory --syntax-check
Run Code Online (Sandbox Code Playgroud)