roles/common: Use dynamic include_tasks for firewall
Use dynamic includes instead of static imports when you are running tasks conditionally or using variable interpolation. The down side is that you need to then tag the parent task as well as all child tasks, as tags only apply to children of statically imported tasks.
This commit is contained in:
@ -18,12 +18,12 @@
|
||||
tags: packages
|
||||
|
||||
- name: Configure firewall
|
||||
import_tasks: firewall_Debian.yml
|
||||
include_tasks: firewall_Debian.yml
|
||||
when: ansible_distribution == 'Debian'
|
||||
tags: firewall
|
||||
|
||||
- name: Configure firewall
|
||||
import_tasks: firewall_Ubuntu.yml
|
||||
include_tasks: firewall_Ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
tags: firewall
|
||||
|
||||
|
Reference in New Issue
Block a user