From 62a45a48ea95e21a7fa748eb3e41bdec5cf08eff Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 22 Sep 2016 12:27:06 +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: Ie732af6a11815d4ee8efa27233d49a173372bb97 Related-Bug: https://github.com/ansible/ansible/issues/17687 --- tasks/cloudkitty_init_common.yml | 2 ++ tasks/cloudkitty_install.yml | 8 ++++---- tasks/main.yml | 8 ++++---- tests/ansible-role-requirements.yml | 4 ++++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tasks/cloudkitty_init_common.yml b/tasks/cloudkitty_init_common.yml index e30f3be..f26873e 100644 --- a/tasks/cloudkitty_init_common.yml +++ b/tasks/cloudkitty_init_common.yml @@ -14,9 +14,11 @@ # limitations under the License. - include: cloudkitty_init_upstart.yml + static: no when: pid1_name == "init" - include: cloudkitty_init_systemd.yml + static: no when: pid1_name == "systemd" - name: Load service diff --git a/tasks/cloudkitty_install.yml b/tasks/cloudkitty_install.yml index 8466fce..dd04d39 100644 --- a/tasks/cloudkitty_install.yml +++ b/tasks/cloudkitty_install.yml @@ -16,14 +16,14 @@ # limitations under the License. - include: cloudkitty_install_apt.yml - when: - - ansible_pkg_mgr == 'apt' + static: no + when: ansible_pkg_mgr == 'apt' tags: - cloudkitty-install - include: cloudkitty_install_yum.yml - when: - - ansible_pkg_mgr == 'yum' + static: no + when: ansible_pkg_mgr == 'yum' tags: - cloudkitty-install diff --git a/tasks/main.yml b/tasks/main.yml index fb7a17c..80e3057 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -43,12 +43,12 @@ - include: cloudkitty_post_install.yml - include: cloudkitty_domain_setup.yml - when: > - inventory_hostname == groups['cloudkitty_all'][0] + static: no + when: inventory_hostname == groups['cloudkitty_all'][0] - include: cloudkitty_db_setup.yml - when: > - inventory_hostname == groups['cloudkitty_all'][0] + static: no + when: inventory_hostname == groups['cloudkitty_all'][0] - include: cloudkitty_init.yml diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index e4a6a08..ba9188a 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -10,6 +10,10 @@ src: https://git.openstack.org/openstack/openstack-ansible-memcached_server 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