Convert dynamic includes to static imports

When task/role files are included using include_tasks, tags are not
passed to the included tasks. As a result, tags like neutron-config
do not have the intended effect. This patch changes include_tasks
to import_tasks for all cases where dynamic vars or loops are not used
so that tags are properly handled.

Reference -
https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse.html
https://bugs.launchpad.net/openstack-ansible/+bug/1815043

Change-Id: I6d906c095b3c039fc3789e37dca03f4b734aab46
This commit is contained in:
Dmitriy Rabotyagov 2019-07-16 20:32:45 +03:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent d8eeb07880
commit 2a433b2fa0
2 changed files with 16 additions and 16 deletions

View File

@ -73,20 +73,20 @@
- common-mq
- barbican-config
- include_tasks: barbican_pre_install.yml
- import_tasks: barbican_pre_install.yml
tags:
- barbican-install
- include_tasks: barbican_install.yml
- import_tasks: barbican_install.yml
tags:
- barbican-install
- include_tasks: barbican_post_install.yml
- import_tasks: barbican_post_install.yml
tags:
- barbican-config
- name: Run the systemd service role
include_role:
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ barbican_system_user_name }}"
@ -99,26 +99,18 @@
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services:
- service_name: "{{ service_var.service_name }}"
enabled: true
execstarts: "{{ service_var.execstarts }}"
execreloads: "{{ service_var.execreloads | default([]) }}"
config_overrides: "{{ service_var.init_config_overrides }}"
with_items: "{{ filtered_barbican_services }}"
loop_control:
loop_var: service_var
systemd_services: "{{ filtered_barbican_services }}"
tags:
- barbican-config
- systemd-service
- include_tasks: barbican_db_sync.yml
- import_tasks: barbican_db_sync.yml
when:
- inventory_hostname == groups['barbican_all'][0]
tags:
- barbican-config
- include_tasks: barbican_service_setup.yml
- import_tasks: barbican_service_setup.yml
when:
- inventory_hostname == groups['barbican_all'][0]
tags:

View File

@ -24,7 +24,15 @@ filtered_barbican_services: |-
{% if (value['group'] in group_names) and
(('condition' not in value) or
('condition' in value and value['condition'])) %}
{% set _ = value.update({'service_key': key}) %}
{% set _ = value.update(
{
'service_key': key,
'enabled': 'yes',
'config_overrides': value.init_config_overrides
}
)
%}
{% set _ = value.pop('init_config_overrides') -%}
{% set _ = services.append(value) %}
{% endif %}
{% endfor %}