Force Ansible to use dynamic includes

Ansible 2.1.1 introduces a regression in the way conditional
includes are handled which results in every task in the
included file being evaluated even if the condition for the
include is not met. This extends the run time significantly
for a deployment.

This patch forces all conditional includes which are not
inventory based to be dynamic.

Change-Id: Ied462a7b79cb2d6615e110484ea734e136f59034
Related-Bug: https://github.com/ansible/ansible/issues/17687
This commit is contained in:
Jesse Pretorius 2016-09-21 18:51:59 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 3840b3807e
commit 768b47ab29
4 changed files with 16 additions and 16 deletions

View File

@ -39,8 +39,8 @@
# Check the swift_hash_path_* variables haven't changed # Check the swift_hash_path_* variables haven't changed
- include: swift_check_hashes.yml - include: swift_check_hashes.yml
when: static: no
- not swift_force_change_hashes | bool when: not swift_force_change_hashes | bool
tags: tags:
- swift-config - swift-config
@ -107,20 +107,20 @@
meta: flush_handlers meta: flush_handlers
- include: swift_key_setup.yml - include: swift_key_setup.yml
when: static: no
- swift_do_sync | bool when: swift_do_sync | bool
tags: tags:
- swift-config - swift-config
- include: swift_rings.yml - include: swift_rings.yml
when: static: no
- swift_do_sync | bool when: swift_do_sync | bool
tags: tags:
- swift-install - swift-install
- swift-config - swift-config
- include: swift_sync_post_install.yml - include: swift_sync_post_install.yml
when: static: no
- swift_do_sync | bool when: swift_do_sync | bool
tags: tags:
- always - always

View File

@ -14,9 +14,11 @@
# limitations under the License. # limitations under the License.
- include: swift_init_upstart.yml - include: swift_init_upstart.yml
static: no
when: pid1_name == "init" when: pid1_name == "init"
- include: swift_init_systemd.yml - include: swift_init_systemd.yml
static: no
when: pid1_name == "systemd" when: pid1_name == "systemd"
- name: Load service - name: Load service

View File

@ -14,8 +14,8 @@
# limitations under the License. # limitations under the License.
- include: install-apt.yml - include: install-apt.yml
when: static: no
- ansible_pkg_mgr == 'apt' when: ansible_pkg_mgr == 'apt'
- name: Create developer mode constraint file - name: Create developer mode constraint file
copy: copy:
@ -157,4 +157,5 @@
- swift_get_venv | success - swift_get_venv | success
- include: swift_pypy_setup.yml - include: swift_pypy_setup.yml
static: no
when: swift_pypy_enabled | bool when: swift_pypy_enabled | bool

View File

@ -16,17 +16,14 @@
- include: swift_rings_md5sum.yml - include: swift_rings_md5sum.yml
- include: swift_rings_check.yml - include: swift_rings_check.yml
when: > when: inventory_hostname == groups['swift_hosts'][0]
inventory_hostname == groups['swift_hosts'][0]
- include: swift_rings_build.yml - include: swift_rings_build.yml
when: > when: inventory_hostname == groups['swift_hosts'][0]
inventory_hostname == groups['swift_hosts'][0]
- include: swift_rings_distribute.yml - include: swift_rings_distribute.yml
- include: swift_rings_md5sum.yml - include: swift_rings_md5sum.yml
- include: swift_rings_post_distribution_check.yml - include: swift_rings_post_distribution_check.yml
when: > when: inventory_hostname == groups['swift_hosts'][0]
inventory_hostname == groups['swift_hosts'][0]