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: I17c230f3178f7227b56969e2654894d4b92108e3
This commit is contained in:
Jesse Pretorius 2016-07-18 16:17:42 +01:00 committed by Jimmy McCrory
parent 7f69cdd1df
commit b9d50ce452
4 changed files with 5 additions and 10 deletions

View File

@ -38,7 +38,7 @@
- name: Install pip packages
pip:
name: "{{ item }}"
name: "{{ nova_compute_pip_packages | join(' ') }}"
state: latest
virtualenv: "{{ nova_bin | dirname }}"
virtualenv_site_packages: "no"
@ -47,7 +47,6 @@
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ nova_compute_pip_packages }}"
when:
- nova_get_venv | failed or nova_developer_mode | bool
tags:

View File

@ -88,7 +88,7 @@
- name: Install pip packages
pip:
name: "{{ item }}"
name: "{{ nova_compute_powervm_pip_packages | join(' ') }}"
state: latest
virtualenv: "{{ nova_bin | dirname }}"
virtualenv_site_packages: "no"
@ -97,7 +97,6 @@
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ nova_compute_powervm_pip_packages }}"
tags:
- nova-install
- nova-pip-packages

View File

@ -40,7 +40,7 @@
- name: Install pip packages
pip:
name: "{{ item }}"
name: "{{ nova_novnc_pip_packages | join(' ') }}"
state: latest
virtualenv: "{{ nova_bin | dirname }}"
virtualenv_site_packages: "no"
@ -49,7 +49,6 @@
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ nova_novnc_pip_packages }}"
when:
- nova_get_venv | failed or nova_developer_mode | bool
tags:

View File

@ -77,14 +77,13 @@
- name: Install requires pip packages
pip:
name: "{{ item }}"
name: "{{ nova_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: "{{ nova_requires_pip_packages }}"
tags:
- nova-install
- nova-pip-packages
@ -172,7 +171,7 @@
- name: Install pip packages
pip:
name: "{{ item }}"
name: "{{ nova_pip_packages | join(' ') }}"
state: latest
virtualenv: "{{ nova_bin | dirname }}"
virtualenv_site_packages: "no"
@ -181,7 +180,6 @@
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ nova_pip_packages }}"
when:
- nova_get_venv | failed or nova_developer_mode | bool
notify: Restart nova services