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: I12ee579625ee6ba493b970601b62f14614ce8658
This commit is contained in:
Jesse Pretorius 2016-07-18 15:56:03 +01:00
parent 94ed7dd654
commit c61739dd38
1 changed files with 2 additions and 4 deletions

View File

@ -51,14 +51,13 @@
- name: Install requires pip packages
pip:
name: "{{ item }}"
name: "{{ glance_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: "{{ glance_requires_pip_packages }}"
- name: Get local venv checksum
stat:
@ -123,7 +122,7 @@
- name: Install pip packages
pip:
name: "{{ item }}"
name: "{{ glance_pip_packages | join(' ') }}"
state: latest
virtualenv: "{{ glance_bin | dirname }}"
virtualenv_site_packages: "no"
@ -132,7 +131,6 @@
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ glance_pip_packages }}"
when:
- glance_get_venv | failed or glance_developer_mode | bool
notify: