1

I have a task that can be used by several roles. I added it to lib/mycommontask.yml

On my playbook on roles/my-project/tasks/main.yml I have:

--
- include: lib/mycommontask.yml
  vars:
    project: my-project
    version: "{{ version }}"

- name: ...

When I run the task, I receive the following error

ERROR: Syntax Error while loading YAML script, /home/lg/src/devops/deploy/roles/my-porject/tasks/main.yml
Note: The error may actually appear before this position: line 2, column 10

--
- include: lib/mycommontask.yml
         ^

Can I include inside a role task? How should I do that?

1 Answer 1

4

For your playbook to be a valid YAML file the 1st line must contain 3 dashes ---, not 2.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .