From 370989b31f40ce581753601a3df3c25265ec3401 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 22 Sep 2016 14:15:38 +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: I6e620e78934b70af09fe175eacf028bc0d68565c Related-Bug: https://github.com/ansible/ansible/issues/17687 --- tasks/main.yml | 5 +++++ tasks/neutron_init_common.yml | 2 ++ tasks/neutron_install.yml | 4 ++-- tasks/neutron_post_install.yml | 6 ++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 2b08f912..39a766ac 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -54,6 +54,7 @@ - always - include: neutron_ml2_ovs_powervm.yml + static: no when: - neutron_os_type is defined - neutron_os_type == 'powervm' @@ -80,11 +81,13 @@ tags: - neutron-install - include: calico_init.yml + static: no when: neutron_plugin_type == 'ml2.calico' tags: - neutron-install - include: neutron_db_setup.yml + static: no when: - neutron_services['neutron-server']['group'] in group_names - inventory_hostname == groups[neutron_services['neutron-server']['group']][0] @@ -92,6 +95,7 @@ - neutron-install - include: neutron_service_setup.yml + static: no when: - "'neutron_all' in group_names" - inventory_hostname == groups['neutron_all'][0] @@ -99,6 +103,7 @@ - neutron-install - include: neutron_l3_ha.yml + static: no when: - neutron_services['neutron-l3-agent']['group'] in group_names - neutron_legacy_ha_tool_enabled | bool diff --git a/tasks/neutron_init_common.yml b/tasks/neutron_init_common.yml index 81b83e74..f90fa028 100644 --- a/tasks/neutron_init_common.yml +++ b/tasks/neutron_init_common.yml @@ -14,9 +14,11 @@ # limitations under the License. - include: neutron_init_upstart.yml + static: no when: pid1_name == "init" - include: neutron_init_systemd.yml + static: no when: pid1_name == "systemd" - name: Load service diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index 6b430a1f..1f36e192 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -14,8 +14,8 @@ # limitations under the License. - include: neutron_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/neutron_post_install.yml b/tasks/neutron_post_install.yml index 95915374..76936bd5 100644 --- a/tasks/neutron_post_install.yml +++ b/tasks/neutron_post_install.yml @@ -64,6 +64,7 @@ - name: Setup Calico config include: calico_config.yml + static: no when: neutron_plugin_type == 'ml2.calico' - name: Generate neutron agent only Config @@ -110,12 +111,13 @@ - name: Setup PLUMgrid config include: plumgrid_config.yml + static: no when: neutron_plugin_type == 'plumgrid' - name: Setup Nuage neutron config include: nuage_neutron_config.yml - when: - - neutron_plugin_type == 'nuage' + static: no + when: neutron_plugin_type == 'nuage' - name: Drop metadata iptables checksum fix copy: