首页 > 解决方案 > 使用角色和任务执行角色

问题描述

我有下一本剧本

---
- hosts:grupo1
  tasks:
    - name: Print a message
      ansible.builtin.debug:
        msg: "this task runs before the example role"

    - name: Include the example role
      include_role:
        name: inicializar

    - name: Print a message
      ansible.builtin.debug:
        msg: "this task runs after the example role"
...

每次我启动它(ansible-playbook UUAA/ECDY/playbooks/CIR_TIBCO_EI_PP_PR_MASTER.yml --extra-var "entorno=DESARROLLO build=1.2.3.4")时,我都会收到以下错误:

ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each: JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML. mapping values are not allowed in this context

该错误似乎在“/home/javi/UUAA/ECDY/playbooks/CIR_TIBCO_EI_PP_PR_MASTER.yml”中:第 3 行,第 8 列,但可能在文件中的其他位置,具体取决于确切的语法问题。

违规行似乎是:

主机:grupo1 任务:^ 这里

知道什么是错误的吗?

标签: ansible

解决方案


键和值之间缺少空格。修理它

- hosts: grupo1

推荐阅读