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: I590de35eb92623f1c280a31db492e1b23726b3f9
This commit is contained in:
Jesse Pretorius 2016-07-18 16:29:03 +01:00
parent 137844d82c
commit db430a4830
1 changed files with 3 additions and 6 deletions

View File

@ -59,14 +59,13 @@
- name: Install requires pip packages
pip:
name: "{{ item }}"
name: "{{ tempest_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: "{{ tempest_requires_pip_packages }}"
tags:
- tempest-install
- tempest-pip-packages
@ -191,7 +190,7 @@
- name: Install pip packages (venv)
pip:
name: "{{ item }}"
name: "{{ tempest_pip_packages | join(' ') }}"
state: latest
virtualenv: "{{ tempest_venv_bin | dirname }}"
virtualenv_site_packages: "no"
@ -200,7 +199,6 @@
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ tempest_pip_packages }}"
when:
- tempest_venv_enabled | bool
- tempest_get_venv | failed or tempest_developer_mode | bool
@ -210,14 +208,13 @@
- name: Install pip packages (no venv)
pip:
name: "{{ item }}"
name: "{{ tempest_pip_packages | join(' ') }}"
state: latest
extra_args: "{{ pip_install_options_fact }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ tempest_pip_packages }}"
when:
- not tempest_venv_enabled | bool
- not tempest_developer_mode | bool