geerlingguy / ansible-role-pip

Ansible Role - Pip (for Python)

Home Page:https://galaxy.ansible.com/geerlingguy/pip/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecation warning in Ansible 2.7

geerlingguy opened this issue · comments

TASK [geerlingguy.pip : Ensure pip_install_packages are installed.] ****************************************************
[DEPRECATION WARNING]: Invoking "pip" only once while using a loop via squash_actions is deprecated. Instead of using a
 loop to supply multiple items and specifying `name: {{ item.name | default(item) }}`, please use `name: u'{{ 
pip_install_packages }}'` and remove the loop. This feature will be removed in version 2.11. Deprecation warnings can 
be disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [server] => (item=[u'docker'])

Still don't know what to do for this.

According to some internal chatter, it sounds like the task will still work in 2.11, it just won't 'squash' all the loop items into one execution of the task. So instead of installing like:

pip install package1===1.2.3 package2===2.3.4

It would install like:

pip install package1===1.2.3
pip install package2===2.3.4

If that's the case, this doesn't seem like a big deal to me; the convenience of easy control over all the pip package install parameters (per package) is more important than task execution time (considering most of my playbooks maybe install 2-3 packages total, not hundreds).

I don't believe anything needs to be done about this. I can see ways that this task could be improved, but since it is allowing either a dict/hash/map or just a string, it is probably best written like this instead of complicated filter logic.

The warning is basically stating that squashing the loop into a single invocation of the pip module will no longer happen in 2.11. This task will continue working, it may just be slower in the future, as it will invoke pip for each item in the loop.

The comment above clarifies some additional things that I was going to add here as well.

@sivel thanks for clarifying. I think I'll leave this issue open until 2.11 anyways, just so people bumping into it have a reference point.

commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.