From 12d56f37ca718f5cf3c4e6b0c65328dd1d7b805a Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 22 Sep 2016 12:28:30 +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: Iea4689aa17b232911275d9a51cfbd5713b78a557 Related-Bug: https://github.com/ansible/ansible/issues/17687 --- tasks/designate_init_common.yml | 2 ++ tasks/designate_install.yml | 4 ++-- tasks/main.yml | 9 ++++----- tests/ansible-role-requirements.yml | 4 ++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tasks/designate_init_common.yml b/tasks/designate_init_common.yml index f5ddee6..4dc2cd6 100644 --- a/tasks/designate_init_common.yml +++ b/tasks/designate_init_common.yml @@ -14,9 +14,11 @@ # limitations under the License. - include: designate_init_upstart.yml + static: no when: pid1_name == "init" - include: designate_init_systemd.yml + static: no when: pid1_name == "systemd" - name: Load service diff --git a/tasks/designate_install.yml b/tasks/designate_install.yml index 3290635..153ceae 100644 --- a/tasks/designate_install.yml +++ b/tasks/designate_install.yml @@ -14,8 +14,8 @@ # limitations under the License. - include: designate_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/tasks/main.yml b/tasks/main.yml index 15f5806..7f84270 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -53,18 +53,17 @@ - designate-install - include: designate_db_setup.yml - when: > - inventory_hostname == groups['designate_all'][0] + static: no + when: inventory_hostname == groups['designate_all'][0] tags: - designate-install - include: designate_service_setup.yml - when: > - inventory_hostname == groups['designate_all'][0] + static: no + when: inventory_hostname == groups['designate_all'][0] tags: - designate-install - name: Flush handlers meta: flush_handlers - diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index 469ed18..aec99d9 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