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: I4755fb3cfed4707cd06299c2ff97a5011c62f147
This commit is contained in:
Dmitriy Rabotjagov 2019-06-17 11:48:29 +03:00
parent 69a77bce05
commit bb98ba104e
3 changed files with 15 additions and 15 deletions

View File

@ -28,7 +28,7 @@
# we should do that and use the delegation to the service setup host
# so that we can remove the openrc file from the target host.
- name: Implement openrc/clouds.yaml
include_role:
import_role:
name: "openstack_openrc"
- name: Create singular cinder_backends variable for all hosts
@ -62,7 +62,7 @@
with_dict: "{{ _cinder_backends|default({}) }}"
when: item.value.extra_volume_types is defined
- include_tasks: cinder_qos.yml
- import_tasks: cinder_qos.yml
when: cinder_qos_specs is defined
tags:
- cinder-qos

View File

@ -37,11 +37,11 @@
delay: 2
- name: Install cinder packages from PIP
include_tasks: cinder_install_source.yml
import_tasks: cinder_install_source.yml
when: cinder_install_method == 'source'
- name: Run the systemd service role
include_role:
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ cinder_system_user_name }}"

View File

@ -74,18 +74,18 @@
- common-mq
- cinder-config
- include: cinder_lvm_config.yml
- import_tasks: cinder_lvm_config.yml
when:
- "cinder_services['cinder-volume']['group'] in group_names"
- "cinder_backend_lvm_inuse | bool"
tags:
- cinder-config
- include_tasks: cinder_pre_install.yml
- import_tasks: cinder_pre_install.yml
tags:
- cinder-install
- include_tasks: cinder_install.yml
- import_tasks: cinder_install.yml
tags:
- cinder-install
@ -96,18 +96,18 @@
tags:
- cinder-config
- include_tasks: cinder_cleanup_old_facts.yml
- import_tasks: cinder_cleanup_old_facts.yml
when:
- "'need_db_sync' in ansible_local['openstack_ansible']['cinder']"
tags:
- cinder-config
- include_tasks: cinder_post_install.yml
- import_tasks: cinder_post_install.yml
tags:
- cinder-config
- name: Run the systemd service role
include_role:
import_role:
name: systemd_service
vars:
systemd_service_enabled: "{{ ((cinder_services['cinder-volume']['group'] in group_names) and (cinder_ceilometer_enabled | bool)) | ternary(true, false) }}"
@ -127,7 +127,7 @@
tags:
- cinder-config
- include_tasks: cinder_db_sync.yml
- import_tasks: cinder_db_sync.yml
when:
- "groups['cinder_api'] | length > 0"
- "cinder_services['cinder-api']['group'] in group_names"
@ -135,11 +135,11 @@
tags:
- cinder-config
- include_tasks: cinder_uwsgi.yml
- import_tasks: cinder_uwsgi.yml
tags:
- cinder-config
- include_tasks: cinder_service_setup.yml
- import_tasks: cinder_service_setup.yml
when:
- "groups['cinder_api'] | length > 0"
- "cinder_services['cinder-api']['group'] in group_names"
@ -148,7 +148,7 @@
- cinder-config
- name: Include ceph_client role
include_role:
import_role:
name: ceph_client
vars:
openstack_service_system_user: "{{ cinder_system_user_name }}"
@ -178,7 +178,7 @@
- name: Flush handlers
meta: flush_handlers
- include_tasks: cinder_backends.yml
- import_tasks: cinder_backends.yml
when:
- "groups[cinder_services['cinder-volume']['group']] | length > 0"
- "cinder_services['cinder-api']['group'] in group_names"