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: I7f7ec9845d9ddc7732d2dc3377dc04d0854f3e9f
This commit is contained in:
Jesse Pretorius 2016-07-18 15:51:33 +01:00
parent 0cad7a46cf
commit 064a42c80f

View File

@ -51,14 +51,13 @@
- name: Install requires pip packages - name: Install requires pip packages
pip: pip:
name: "{{ item }}" name: "{{ cinder_requires_pip_packages | join(' ') }}"
state: latest state: latest
extra_args: "{{ pip_install_options_fact }}" extra_args: "{{ pip_install_options_fact }}"
register: install_packages register: install_packages
until: install_packages|success until: install_packages|success
retries: 5 retries: 5
delay: 2 delay: 2
with_items: "{{ cinder_requires_pip_packages }}"
- name: Get local venv checksum - name: Get local venv checksum
stat: stat:
@ -125,7 +124,7 @@
- name: Install pip packages - name: Install pip packages
pip: pip:
name: "{{ item }}" name: "{{ cinder_pip_packages | join(' ') }}"
state: latest state: latest
virtualenv: "{{ cinder_bin | dirname }}" virtualenv: "{{ cinder_bin | dirname }}"
virtualenv_site_packages: "no" virtualenv_site_packages: "no"
@ -134,7 +133,6 @@
until: install_packages|success until: install_packages|success
retries: 5 retries: 5
delay: 2 delay: 2
with_items: "{{ cinder_pip_packages }}"
when: when:
- cinder_get_venv | failed or cinder_developer_mode | bool - cinder_get_venv | failed or cinder_developer_mode | bool
notify: Restart cinder services notify: Restart cinder services