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 to be dynamic.

Change-Id: I66de661bf9f68a2d91e3a2fec9c1eee826c17592
Related-Bug: https://github.com/ansible/ansible/issues/17687
This commit is contained in:
Jesse Pretorius 2016-09-22 15:57:03 +01:00
parent 75d8000369
commit 2d240b7ac6
3 changed files with 13 additions and 8 deletions

View File

@ -40,17 +40,18 @@
- include: repo_install.yml
- include: repo_post_install.yml
- include: repo_cacher.yml
static: no
when: repo_pkg_cache_enabled | bool
- include: repo_key_populate.yml
- include: repo_key_distribute.yml
when: >
groups.repo_all|length > 1
static: no
when: groups.repo_all|length > 1
- include: repo_sync_manager.yml
when: >
inventory_hostname == groups['repo_all'][0]
static: no
when: inventory_hostname == groups['repo_all'][0]
- name: Flush handlers
meta: flush_handlers

View File

@ -14,13 +14,13 @@
# limitations under the License.
- include: install_apt.yml
when:
- ansible_pkg_mgr == 'apt'
static: no
when: ansible_pkg_mgr == 'apt'
tags:
- repo-apt-packages
- include: install_yum.yml
when:
- ansible_pkg_mgr == 'yum'
static: no
when: ansible_pkg_mgr == 'yum'
tags:
- repo-yum-packages

View File

@ -6,6 +6,10 @@
src: https://git.openstack.org/openstack/openstack-ansible-pip_install
scm: git
version: master
- name: openstack_hosts
src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts
scm: git
version: master
- name: lxc_hosts
src: https://git.openstack.org/openstack/openstack-ansible-lxc_hosts
scm: git