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: Ib9ce9666c737be639825a5b998f57eaca4a25c7d
This commit is contained in:
Jesse Pretorius 2016-07-18 15:43:39 +01:00
parent 470e83c14f
commit 6c75a123cb

View File

@ -27,13 +27,12 @@
- name: Install pip packages
pip:
name: "{{ item }}"
name: "{{ lxc_pip_packages | join(' ') }}"
state: latest
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ lxc_pip_packages }}"
tags:
- lxc-pip-packages