Use include_role for conditional inclusion

When import_role is used with a condition, the condition is
applied to all tasks in the role. This is inefficient. If we
use include_role instead, then the role inclusion task is
skipped and none of the tasks in the role are even evaluated.

Related-bug: rhbz#1922132

Change-Id: I1b4e26fd4a46599985a989441f493a3ed39237bb
(cherry picked from commit 46df551a0f)
This commit is contained in:
Jesse Pretorius (odyssey4me) 2021-01-29 10:39:12 +00:00 committed by Jesse Pretorius
parent 75c35a7c71
commit 9e271664ad
1 changed files with 1 additions and 1 deletions

View File

@ -774,6 +774,6 @@ outputs:
with_items: with_items:
- { 'path': /var/log/containers/collectd, 'setype': container_file_t, 'mode': '0750' } - { 'path': /var/log/containers/collectd, 'setype': container_file_t, 'mode': '0750' }
- name: import provision_mcelog - name: import provision_mcelog
import_role: include_role:
name: tripleo_provision_mcelog name: tripleo_provision_mcelog
when: {get_param: CollectdEnableMcelog} when: {get_param: CollectdEnableMcelog}