From 1f682b09efde5c0ebbda2a61c4c8a27c3f9c4834 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 22 Sep 2016 13:48:22 +0100 Subject: [PATCH] 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 --- tasks/horizon_install.yml | 1 + tasks/horizon_ssl_self_signed.yml | 12 ++++++------ tasks/main.yml | 6 ++++-- tests/ansible-role-requirements.yml | 4 ++++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index e6a40564..8ba7b44b 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -14,6 +14,7 @@ # limitations under the License. - include: install-apt.yml + static: no when: - ansible_pkg_mgr == 'apt' diff --git a/tasks/horizon_ssl_self_signed.yml b/tasks/horizon_ssl_self_signed.yml index d3554b77..e41bf2b7 100644 --- a/tasks/horizon_ssl_self_signed.yml +++ b/tasks/horizon_ssl_self_signed.yml @@ -14,13 +14,13 @@ # limitations under the License. - include: horizon_ssl_key_create.yml - when: > - inventory_hostname == groups['horizon_all'][0] + static: no + when: inventory_hostname == groups['horizon_all'][0] - include: horizon_ssl_key_store.yml - when: > - inventory_hostname == groups['horizon_all'][0] + static: no + when: inventory_hostname == groups['horizon_all'][0] - include: horizon_ssl_key_distribute.yml - when: > - inventory_hostname != groups['horizon_all'][0] + static: no + when: inventory_hostname != groups['horizon_all'][0] diff --git a/tasks/main.yml b/tasks/main.yml index 21e8c516..47c0f129 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -38,12 +38,13 @@ - horizon-config - include: horizon_db_setup.yml - when: > - inventory_hostname == groups['horizon_all'][0] + static: no + when: inventory_hostname == groups['horizon_all'][0] tags: - horizon-install - include: horizon_ssl_self_signed.yml + static: no when: - not horizon_external_ssl|bool - horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined @@ -51,6 +52,7 @@ - horizon-install - include: horizon_ssl_user_provided.yml + static: no when: not horizon_external_ssl|bool tags: - horizon-install diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index 97109303..777f817f 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -18,6 +18,10 @@ src: https://git.openstack.org/openstack/openstack-ansible-lxc_container_create 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