debops / debops-playbooks

Ansible playbooks used by DebOps project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pre/post hook tasks do not process included tasks

gabor-udvari opened this issue · comments

I have a set of existing tasks which I would like to run during the DebOps playbooks with pre/post hooks. When I include my own tasks into the pre/post hook tasks, then the steps inside the included task will not be processed:

example nginx/pre_main.yml:

---
- debug:
    msg: "Pre hook executed"

- include: tasks/custom.yml

The debug message (and any other steps) are correctly executed, but the include is ignored. If I simply make the nginx/pre_main.yml a symbolic link to the nginx/task/custom.yml then everything is working as expected. But I can only reference a single file that way.

$ ls -l nginx/pre_main.yml
lrwxrwxrwx 1 udi udi 17 2017-07-24 21:37 nginx/pre_main.yml -> tasks/parking.yml

I tried the include with every possible relative path and absolute path, not finding the file is not the issue.

The lookup module does not support includes - this is not an Ansible mechanism, but a custom DebOps lookup plugin. You need to put your tasks in the nginx/pre_main.yml file directly. Or, create a custom playbook that includes the debops.nginx role and its dependencies, and your own custom role.