Ansible yaml语法失败

时间:2014-09-26 11:58:13

标签: 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
~ 

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

当我执行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'>

1 个答案:

答案 0 :(得分:7)

复习缩进。这段代码对我有用。

- name: common | setup impactGroup group
  group: name=group system=no gid=510
  ignore_errors: yes

首先使用--syntax-check选项进行检查:

/usr/bin/ansible-playbook -D /tmp/eabinay/test.yml -i /tmp/eabinay/dbServerInventory --syntax-check