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
- include: swift_check_hashes.yml
when:
- not swift_force_change_hashes | bool
static: no
when: not swift_force_change_hashes | bool
tags:
- swift-config
@ -107,20 +107,20 @@
meta: flush_handlers
- include: swift_key_setup.yml
when:
- swift_do_sync | bool
static: no
when: swift_do_sync | bool
tags:
- swift-config
- include: swift_rings.yml
when:
- swift_do_sync | bool
static: no
when: swift_do_sync | bool
tags:
- swift-install
- swift-config
- include: swift_sync_post_install.yml
when:
- swift_do_sync | bool
static: no
when: swift_do_sync | bool
tags:
- always

View File

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

View File

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

View File

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