debops / debops-playbooks

Ansible playbooks used by DebOps project
GNU General Public License v3.0
489 stars 88 forks source link

Pre/post hook tasks do not process included tasks #383

Open gabor-udvari opened 7 years ago

gabor-udvari commented 7 years ago

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.

drybjed commented 7 years ago

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.