From d815a1f4859144e478e97326eabb2fadc4874e41 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 18 Jul 2016 15:54:16 +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: I4ce24c9d557d173a452ee74a619c771b2bed5af8 --- tasks/designate_install.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tasks/designate_install.yml b/tasks/designate_install.yml index fadc03e..3290635 100644 --- a/tasks/designate_install.yml +++ b/tasks/designate_install.yml @@ -51,14 +51,13 @@ - name: Install requires pip packages pip: - name: "{{ item }}" + name: "{{ designate_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: "{{ designate_requires_pip_packages }}" - name: Get local venv checksum stat: @@ -126,7 +125,7 @@ - name: Install pip packages pip: - name: "{{ item }}" + name: "{{ designate_pip_packages | join(' ') }}" state: latest virtualenv: "{{ designate_bin | dirname }}" virtualenv_site_packages: "no" @@ -135,7 +134,6 @@ until: install_packages|success retries: 5 delay: 2 - with_items: "{{ designate_pip_packages }}" when: - designate_get_venv | failed or designate_developer_mode | bool notify: