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
|
- common-mq
|
||||||
- congress-config
|
- congress-config
|
||||||
|
|
||||||
- include_tasks: congress_pre_install.yml
|
- import_tasks: congress_pre_install.yml
|
||||||
tags:
|
tags:
|
||||||
- congress-install
|
- congress-install
|
||||||
|
|
||||||
|
@ -82,12 +82,12 @@
|
||||||
tags:
|
tags:
|
||||||
- congress-install
|
- congress-install
|
||||||
|
|
||||||
- include_tasks: congress_post_install.yml
|
- import_tasks: congress_post_install.yml
|
||||||
tags:
|
tags:
|
||||||
- congress-config
|
- congress-config
|
||||||
|
|
||||||
- name: Run the systemd service role
|
- name: Run the systemd service role
|
||||||
include_role:
|
import_role:
|
||||||
name: systemd_service
|
name: systemd_service
|
||||||
vars:
|
vars:
|
||||||
systemd_user_name: "{{ congress_system_user_name }}"
|
systemd_user_name: "{{ congress_system_user_name }}"
|
||||||
|
@ -99,27 +99,18 @@
|
||||||
systemd_BlockIOAccounting: true
|
systemd_BlockIOAccounting: true
|
||||||
systemd_MemoryAccounting: true
|
systemd_MemoryAccounting: true
|
||||||
systemd_TasksAccounting: true
|
systemd_TasksAccounting: true
|
||||||
systemd_services:
|
systemd_services: "{{ filtered_congress_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
|
|
||||||
tags:
|
tags:
|
||||||
- congress-config
|
- congress-config
|
||||||
- systemd-service
|
- systemd-service
|
||||||
|
|
||||||
- include_tasks: congress_db_setup.yml
|
- import_tasks: congress_db_setup.yml
|
||||||
when:
|
when:
|
||||||
- "inventory_hostname == ((groups['congress_all'] | intersect(ansible_play_hosts)) | list)[0]"
|
- "inventory_hostname == ((groups['congress_all'] | intersect(ansible_play_hosts)) | list)[0]"
|
||||||
tags:
|
tags:
|
||||||
- congress-config
|
- congress-config
|
||||||
|
|
||||||
- include_tasks: congress_service_setup.yml
|
- import_tasks: congress_service_setup.yml
|
||||||
when:
|
when:
|
||||||
- "inventory_hostname == ((groups['congress_all'] | intersect(ansible_play_hosts)) | list)[0]"
|
- "inventory_hostname == ((groups['congress_all'] | intersect(ansible_play_hosts)) | list)[0]"
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -24,7 +24,16 @@ filtered_congress_services: |-
|
||||||
{% if (value['group'] in group_names) and
|
{% if (value['group'] in group_names) and
|
||||||
(('condition' not in value) or
|
(('condition' not in value) or
|
||||||
('condition' in value and value['condition'])) %}
|
('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) %}
|
{% set _ = services.append(value) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue