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 swift-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: I7553c3ef4d7620844f614da79b2cb1086eda23cb
This commit is contained in:
Dmitriy Rabotyagov 2019-07-17 19:25:40 +03:00
parent 6d64e4d0eb
commit 273895816b

View File

@ -40,60 +40,60 @@
- always - always
# Check the swift_hash_path_* variables haven't changed # Check the swift_hash_path_* variables haven't changed
- include_tasks: swift_check_hashes.yml - import_tasks: swift_check_hashes.yml
when: when:
- "not swift_force_change_hashes | bool" - "not swift_force_change_hashes | bool"
tags: tags:
- swift-config - swift-config
- include_tasks: swift_pre_install.yml - import_tasks: swift_pre_install.yml
when: when:
- "swift_do_setup | bool" - "swift_do_setup | bool"
- "'swift_all' in group_names" - "'swift_all' in group_names"
tags: tags:
- swift-install - swift-install
- include_tasks: swift_install.yml - import_tasks: swift_install.yml
when: when:
- "swift_do_setup | bool" - "swift_do_setup | bool"
- "'swift_all' in group_names" - "'swift_all' in group_names"
tags: tags:
- swift-install - swift-install
- include_tasks: swift_post_install.yml - import_tasks: swift_post_install.yml
when: when:
- "swift_do_setup | bool" - "swift_do_setup | bool"
- "'swift_all' in group_names" - "'swift_all' in group_names"
tags: tags:
- swift-config - swift-config
- include_tasks: swift_calculate_addresses.yml - import_tasks: swift_calculate_addresses.yml
when: when:
- "'swift_hosts' in group_names" - "'swift_hosts' in group_names"
tags: tags:
- always - always
- include_tasks: swift_storage_hosts.yml - import_tasks: swift_storage_hosts.yml
when: when:
- "swift_do_setup | bool" - "swift_do_setup | bool"
- "'swift_hosts' in group_names" - "'swift_hosts' in group_names"
tags: tags:
- swift-config - swift-config
- include_tasks: swift_proxy_hosts.yml - import_tasks: swift_proxy_hosts.yml
when: when:
- "swift_do_setup | bool" - "swift_do_setup | bool"
- "'swift_proxy' in group_names" - "'swift_proxy' in group_names"
tags: tags:
- swift-config - swift-config
- include_tasks: swift_key_setup.yml - import_tasks: swift_key_setup.yml
when: when:
- "swift_do_sync | bool" - "swift_do_sync | bool"
tags: tags:
- swift-config - swift-config
- include_tasks: swift_rings.yml - import_tasks: swift_rings.yml
when: when:
- "swift_do_sync | bool" - "swift_do_sync | bool"
tags: tags:
@ -101,7 +101,7 @@
- swift-rings - swift-rings
- 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: "{{ swift_system_user_name }}" systemd_user_name: "{{ swift_system_user_name }}"
@ -148,7 +148,7 @@
- common-mq - common-mq
- swift-config - swift-config
- include_tasks: swift_service_setup.yml - import_tasks: swift_service_setup.yml
when: when:
- "swift_do_setup | bool" - "swift_do_setup | bool"
- '"keystoneauth" in swift_middleware_list' - '"keystoneauth" in swift_middleware_list'