NoamiA
NoamiA

Reputation: 567

Ansible: ignoring erros in include tasks

I have in my yml include to a certain yml can I add ignore_erors like:

include: ../test.tml
ignore_errors: yes

or only in the playbook I included itself thanks.

Upvotes: 2

Views: 2740

Answers (1)

Vladimir Botka
Vladimir Botka

Reputation: 68404

Playbook keywords can be applied to 4 objects: a play, role, block, task. ignore_errors can be applied to all of them.


Correct syntax

In your example, include is a task. The correct syntax is

- include: ../test.yml
  ignore_errors: yes

Include is deprecated

Quoting from include - Include a play or task list

The include action was too confusing, dealing with both plays and tasks, being both dynamic and static. This module will be removed in version 2.8. As alternatives use include_tasks, import_playbook, import_tasks.

Upvotes: 2

Related Questions