From 3a6717a782a171f8528405a1fbd1f480a683498b Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 18 Jul 2016 16:09:31 +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: I1bd9d6f8e9ccd338e7417fa583d5a218ea499181 --- tasks/ironic_install.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tasks/ironic_install.yml b/tasks/ironic_install.yml index 43914136..3232ea8c 100644 --- a/tasks/ironic_install.yml +++ b/tasks/ironic_install.yml @@ -70,14 +70,13 @@ - name: Install requires pip packages pip: - name: "{{ item }}" + name: "{{ ironic_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: "{{ ironic_requires_pip_packages }}" tags: - ironic-install - ironic-pip-packages @@ -165,7 +164,7 @@ - name: Install pip packages pip: - name: "{{ item }}" + name: "{{ ironic_pip_packages | join(' ') }}" state: latest virtualenv: "{{ ironic_bin | dirname }}" virtualenv_site_packages: "no" @@ -174,7 +173,6 @@ until: install_packages|success retries: 5 delay: 2 - with_items: "{{ ironic_pip_packages }}" when: - ironic_get_venv | failed or ironic_developer_mode | bool notify: Restart ironic services