From 0b56e3dc7e5b1cb66de734e6d99e8b56d6d3ff6b Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 22 Sep 2016 12:18:16 +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: I27afcb8e650dc296e06d2bfaa9e084eb406fa4ef Related-Bug: https://github.com/ansible/ansible/issues/17687 --- tasks/init_common.yml | 2 ++ tasks/install.yml | 1 + tasks/main.yml | 8 ++++---- tasks/self-signed-ssl.yml | 12 ++++++------ tasks/ssl.yml | 7 ++++--- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tasks/init_common.yml b/tasks/init_common.yml index 8992d9b..52ef710 100644 --- a/tasks/init_common.yml +++ b/tasks/init_common.yml @@ -14,9 +14,11 @@ # limitations under the License. - include: init_upstart.yml + static: no when: pid1_name == "init" - include: init_systemd.yml + static: no when: pid1_name == "systemd" - name: Load service diff --git a/tasks/install.yml b/tasks/install.yml index 52b7e29..dd6d723 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -14,6 +14,7 @@ # limitations under the License. - include: barbican_install_apt.yml + static: no when: - ansible_pkg_mgr == 'apt' diff --git a/tasks/main.yml b/tasks/main.yml index f0fc6bf..98f65be 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -57,14 +57,14 @@ - barbican-config - include: database-setup.yml - when: > - inventory_hostname == groups['barbican_all'][0] + static: no + when: inventory_hostname == groups['barbican_all'][0] tags: - barbican-install - include: service-setup.yml - when: > - inventory_hostname == groups['barbican_all'][0] + static: no + when: inventory_hostname == groups['barbican_all'][0] tags: - barbican-install diff --git a/tasks/self-signed-ssl.yml b/tasks/self-signed-ssl.yml index f7efd30..9b7eb09 100644 --- a/tasks/self-signed-ssl.yml +++ b/tasks/self-signed-ssl.yml @@ -14,13 +14,13 @@ # limitations under the License. - include: create-ssl-key.yml - when: > - inventory_hostname == groups['barbican_all'][0] + static: no + when: inventory_hostname == groups['barbican_all'][0] - include: store-ssl-key.yml - when: > - inventory_hostname == groups['barbican_all'][0] + static: no + when: inventory_hostname == groups['barbican_all'][0] - include: distribute-ssl-key.yml - when: > - inventory_hostname != groups['barbican_all'][0] + static: no + when: inventory_hostname != groups['barbican_all'][0] diff --git a/tasks/ssl.yml b/tasks/ssl.yml index 5c3fcc5..1210b1b 100644 --- a/tasks/ssl.yml +++ b/tasks/ssl.yml @@ -14,8 +14,9 @@ # limitations under the License. - include: self-signed-ssl.yml - when: > - barbican_ssl | bool and - (barbican_user_ssl_cert is not defined or barbican_user_ssl_key is not defined) + static: no + when: + - barbican_ssl | bool + - barbican_user_ssl_cert is not defined or barbican_user_ssl_key is not defined - include: user-provided-ssl.yml