roles/nginx: Use dynamic includes for tasks

As of Ansible 2.4 and 2.5 the behavior for importing tasks has changed
to introduce the notion of static imports and dynamic includes. If the
tasks doing the import is using variable interpolation or conditionals
then the task should be dynamic. This results in quicker playbook runs
due to less importing of unneccessary tasks.

One side effect of this is that child tasks of dynamic includes do not
inherit their parents' tags so you must tag them explicitly or a block.
This commit is contained in:
2018-04-26 10:45:01 +03:00
parent c608331e3c
commit 2da7f39bb4
2 changed files with 32 additions and 30 deletions

View File

@ -35,7 +35,7 @@
tags: nginx
- name: Configure nginx virtual hosts
import_tasks: vhosts.yml
include_tasks: vhosts.yml
when: nginx_vhosts is defined
tags: nginx