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:
parent
c608331e3c
commit
2da7f39bb4
@ -35,7 +35,7 @@
|
|||||||
tags: nginx
|
tags: nginx
|
||||||
|
|
||||||
- name: Configure nginx virtual hosts
|
- name: Configure nginx virtual hosts
|
||||||
import_tasks: vhosts.yml
|
include_tasks: vhosts.yml
|
||||||
when: nginx_vhosts is defined
|
when: nginx_vhosts is defined
|
||||||
tags: nginx
|
tags: nginx
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
- block:
|
||||||
- name: Configure https vhosts
|
- name: Configure https vhosts
|
||||||
template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.domain_name }}.conf mode=0644 owner=root group=root
|
template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.domain_name }}.conf mode=0644 owner=root group=root
|
||||||
loop: "{{ nginx_vhosts }}"
|
loop: "{{ nginx_vhosts }}"
|
||||||
@ -35,5 +36,6 @@
|
|||||||
- include_tasks: letsencrypt.yml
|
- include_tasks: letsencrypt.yml
|
||||||
when: use_letsencrypt is defined and use_letsencrypt == True
|
when: use_letsencrypt is defined and use_letsencrypt == True
|
||||||
tags: letsencrypt
|
tags: letsencrypt
|
||||||
|
tags: nginx
|
||||||
|
|
||||||
# vim: set ts=2 sw=2:
|
# vim: set ts=2 sw=2:
|
||||||
|
Loading…
Reference in New Issue
Block a user