roles/nginx: Use dynamic includes for Let's Encrypt

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.

Also, I had to move the letsencrypt tasks to the main task file so the
tags were available (due to dynamic tasks not inheriting tags).
This commit is contained in:
2018-04-26 11:00:47 +03:00
parent 2da7f39bb4
commit 1738507ee9
3 changed files with 35 additions and 40 deletions

View File

@ -32,10 +32,6 @@
when: item.has_wordpress is defined and item.has_wordpress == True
loop: "{{ nginx_vhosts }}"
tags: wordpress
- include_tasks: letsencrypt.yml
when: use_letsencrypt is defined and use_letsencrypt == True
tags: letsencrypt
tags: nginx
# vim: set ts=2 sw=2: