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: I72dabf1abace382f0b25499aaa56366a9baefa48
Related-Bug: https://github.com/ansible/ansible/issues/17687
This commit is contained in:
Jesse Pretorius 2016-09-22 13:48:22 +01:00
parent 988006d22d
commit 1f682b09ef
4 changed files with 15 additions and 8 deletions

View File

@ -14,6 +14,7 @@
# limitations under the License. # limitations under the License.
- include: install-apt.yml - include: install-apt.yml
static: no
when: when:
- ansible_pkg_mgr == 'apt' - ansible_pkg_mgr == 'apt'

View File

@ -14,13 +14,13 @@
# limitations under the License. # limitations under the License.
- include: horizon_ssl_key_create.yml - include: horizon_ssl_key_create.yml
when: > static: no
inventory_hostname == groups['horizon_all'][0] when: inventory_hostname == groups['horizon_all'][0]
- include: horizon_ssl_key_store.yml - include: horizon_ssl_key_store.yml
when: > static: no
inventory_hostname == groups['horizon_all'][0] when: inventory_hostname == groups['horizon_all'][0]
- include: horizon_ssl_key_distribute.yml - include: horizon_ssl_key_distribute.yml
when: > static: no
inventory_hostname != groups['horizon_all'][0] when: inventory_hostname != groups['horizon_all'][0]

View File

@ -38,12 +38,13 @@
- horizon-config - horizon-config
- include: horizon_db_setup.yml - include: horizon_db_setup.yml
when: > static: no
inventory_hostname == groups['horizon_all'][0] when: inventory_hostname == groups['horizon_all'][0]
tags: tags:
- horizon-install - horizon-install
- include: horizon_ssl_self_signed.yml - include: horizon_ssl_self_signed.yml
static: no
when: when:
- not horizon_external_ssl|bool - not horizon_external_ssl|bool
- horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined - horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined
@ -51,6 +52,7 @@
- horizon-install - horizon-install
- include: horizon_ssl_user_provided.yml - include: horizon_ssl_user_provided.yml
static: no
when: not horizon_external_ssl|bool when: not horizon_external_ssl|bool
tags: tags:
- horizon-install - horizon-install

View File

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