From 9b4c1cc1cd5c727cf60616564b0a83a3deb25049 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 18 Jul 2016 16:08:17 +0100 Subject: [PATCH] Optimise pip install tasks Unlike the Ansible apt module, the Ansible pip module does not recognise a with_items list and process all the items at once. To optimise the pip install tasks, this patch replaces the use of with_items with a join filter so that the pip install task does an install with all the packages in a list, ensuring that the execution is one action instead of many. Change-Id: Iaca857cbc31a915b8fdecfe4a06f5afb5abb46bf --- tasks/horizon_install.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index dafeeb3f..e6a40564 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -51,14 +51,13 @@ - name: Install requires pip packages pip: - name: "{{ item }}" + name: "{{ horizon_requires_pip_packages | join(' ') }}" state: latest extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 delay: 2 - with_items: "{{ horizon_requires_pip_packages }}" - name: Get local venv checksum stat: @@ -125,7 +124,7 @@ - name: Install pip packages pip: - name: "{{ item }}" + name: "{{ horizon_pip_packages | join(' ') }}" state: latest virtualenv: "{{ horizon_bin | dirname }}" virtualenv_site_packages: "no" @@ -134,7 +133,6 @@ until: install_packages|success retries: 5 delay: 2 - with_items: "{{ horizon_pip_packages }}" when: - horizon_get_venv | failed or horizon_developer_mode | bool notify: Restart apache2