From c588ac18fdb11532b3c2ad4792a4ae81f334bbfc Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 22 Sep 2016 15:46:20 +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: Ifab57201c962b084a1d531d788b25526cd899ce4 Related-Bug: https://github.com/ansible/ansible/issues/17687 --- tasks/main.yml | 3 +++ tasks/trove_init_common.yml | 3 +++ tasks/trove_install.yml | 5 +++-- tests/ansible-role-requirements.yml | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 14b09eb..842cda3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -56,16 +56,19 @@ - trove-install - include: trove_service_setup.yml + static: no when: inventory_hostname == groups['trove_api'][0] tags: - trove-install - include: trove_db_setup.yml + static: no when: inventory_hostname == groups['trove_conductor'][0] tags: - trove-install - include: trove_apache.yml + static: no when: trove_use_mod_wsgi | bool tags: - trove-install diff --git a/tasks/trove_init_common.yml b/tasks/trove_init_common.yml index b4f36b0..08e952c 100644 --- a/tasks/trove_init_common.yml +++ b/tasks/trove_init_common.yml @@ -15,10 +15,13 @@ # # (c) 2016 Donovan Francesco # (c) 2016 Paul Stevens + - include: trove_init_upstart.yml + static: no when: pid1_name == "init" - include: trove_init_systemd.yml + static: no when: pid1_name == "systemd" - name: Load service diff --git a/tasks/trove_install.yml b/tasks/trove_install.yml index c402273..fe9d608 100644 --- a/tasks/trove_install.yml +++ b/tasks/trove_install.yml @@ -15,9 +15,10 @@ # # (c) 2016 Donovan Francesco # (c) 2016 Paul Stevens + - include: trove_install_apt.yml - when: - - ansible_pkg_mgr == 'apt' + static: no + when: ansible_pkg_mgr == 'apt' - name: Create developer mode constraint file copy: 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