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: Ifc210d2fc7f217105d83c0ad4f86a3939c6c93d3
This commit is contained in:
parent
c2f0c9a16c
commit
78bc984ade
@ -58,7 +58,7 @@
|
||||
- common-mq
|
||||
- congress-config
|
||||
|
||||
- include_tasks: congress_pre_install.yml
|
||||
- import_tasks: congress_pre_install.yml
|
||||
tags:
|
||||
- congress-install
|
||||
|
||||
@ -82,12 +82,12 @@
|
||||
tags:
|
||||
- congress-install
|
||||
|
||||
- include_tasks: congress_post_install.yml
|
||||
- import_tasks: congress_post_install.yml
|
||||
tags:
|
||||
- congress-config
|
||||
|
||||
- name: Run the systemd service role
|
||||
include_role:
|
||||
import_role:
|
||||
name: systemd_service
|
||||
vars:
|
||||
systemd_user_name: "{{ congress_system_user_name }}"
|
||||
@ -99,27 +99,18 @@
|
||||
systemd_BlockIOAccounting: true
|
||||
systemd_MemoryAccounting: true
|
||||
systemd_TasksAccounting: true
|
||||
systemd_services:
|
||||
- service_name: "{{ service_var.service_name }}"
|
||||
enabled: yes
|
||||
state: started
|
||||
execstarts: "{{ service_var.execstarts }}"
|
||||
execreloads: "{{ service_var.execreloads | default([]) }}"
|
||||
config_overrides: "{{ service_var.init_config_overrides }}"
|
||||
with_items: "{{ filtered_congress_services }}"
|
||||
loop_control:
|
||||
loop_var: service_var
|
||||
systemd_services: "{{ filtered_congress_services }}"
|
||||
tags:
|
||||
- congress-config
|
||||
- systemd-service
|
||||
|
||||
- include_tasks: congress_db_setup.yml
|
||||
- import_tasks: congress_db_setup.yml
|
||||
when:
|
||||
- "inventory_hostname == ((groups['congress_all'] | intersect(ansible_play_hosts)) | list)[0]"
|
||||
tags:
|
||||
- congress-config
|
||||
|
||||
- include_tasks: congress_service_setup.yml
|
||||
- import_tasks: congress_service_setup.yml
|
||||
when:
|
||||
- "inventory_hostname == ((groups['congress_all'] | intersect(ansible_play_hosts)) | list)[0]"
|
||||
tags:
|
||||
|
@ -24,7 +24,16 @@ filtered_congress_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',
|
||||
'state': 'started',
|
||||
'config_overrides': value.init_config_overrides
|
||||
}
|
||||
)
|
||||
%}
|
||||
{% set _ = value.pop('init_config_overrides') -%}
|
||||
{% set _ = services.append(value) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user