pip install list of packages

63 views
Skip to first unread message

Dick Visser

unread,
Oct 6, 2020, 10:34:48 AM10/6/20
to ansible...@googlegroups.com
Hi

If I'm using pip with name being a list of packages, for instance:

- name: Install stuff
pip:
name:
- pyyaml
- natsort
- passlib

Then the module will do "pip install pyyaml natsort passlib", and not:

pip install pyyaml
pip install natsort
pip install passlib


Is this assumption correct?



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Idan Melamed

unread,
Oct 8, 2020, 5:16:44 AM10/8/20
to Ansible Project
Hi Dick,

From my experience, it does the latter.

I'm doing this:
    - name: Install Python packages
      pip:
        name: "{{ item.name }}"
        version: "{{ item.version }}"
        executable: pip2
      become: yes
      with_items:
        - { name: 'alembic', version: '1.1.0' }
        - { name: 'aniso8601', version: '7.0.0' }
        - { name: 'anyjson', version: '0.3.3' }
        - { name: 'articleDateExtractor', version: '0.20' }

And it pip installs every one of them separately.

Idan Melamed

unread,
Oct 8, 2020, 7:46:52 AM10/8/20
to Ansible Project
It seems that I was wrong.
Ansible runs each of my iterations as a different command because I'm using with_items.

Dick Visser

unread,
Oct 8, 2020, 8:04:54 AM10/8/20
to ansible...@googlegroups.com
Yes, I noticed that.
So that is the distinction then.
I guess this is similar to the apt/package/etc modules, where you are
encouraged to use a list for 'name' so that the package manager can
install the whole lot in one go.

thx
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/eae6ca54-102f-405d-9eb1-4a389db3d41fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages