{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3055","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3055/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3055/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3055/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3055","id":134274905,"number":3055,"title":"pip module always shows changed in --check mode when state=latest","user":{"login":"mgedmin","id":159967,"avatar_url":"https://avatars.githubusercontent.com/u/159967?v=3","gravatar_id":"","url":"https://api.github.com/users/mgedmin","html_url":"https://github.com/mgedmin","followers_url":"https://api.github.com/users/mgedmin/followers","following_url":"https://api.github.com/users/mgedmin/following{/other_user}","gists_url":"https://api.github.com/users/mgedmin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgedmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgedmin/subscriptions","organizations_url":"https://api.github.com/users/mgedmin/orgs","repos_url":"https://api.github.com/users/mgedmin/repos","events_url":"https://api.github.com/users/mgedmin/events{/privacy}","received_events_url":"https://api.github.com/users/mgedmin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-17T13:07:51Z","updated_at":"2016-02-17T13:31:46Z","closed_at":null,"body":"**Ansible version**\r\nansible 2.1.0 (devel 875ea74621) last updated 2016/02/17 08:28:52 (GMT +300)\r\n  lib/ansible/modules/core: (detached HEAD 8d126bd877) last updated 2016/02/15 09:14:28 (GMT +300)\r\n  lib/ansible/modules/extras: (detached HEAD f6c5ed987f) last updated 2016/02/12 08:50:23 (GMT +300)\r\n\r\n**Summary**\r\n\r\nThis is similar to #2848, except I'm unhappy about the other case in the branch, about `state=latest`.\r\n\r\n**Steps to reproduce**\r\n\r\nHave a task like this:\r\n\r\n```yml\r\n- name: install letsencrypt\r\n  pip: name={{ item }} virtualenv=/opt/letsencrypt state=latest\r\n  with_items:\r\n    - pip\r\n    - setuptools\r\n    - letsencrypt\r\n    - letsencrypt-apache\r\n```\r\n\r\nRun it with `ansible -C`\r\n\r\n**Expected behavior**\r\n\r\n- doesn't report changed unless there are newer versions of any of the packages requested (or their dependencies) on the Python Package Index\r\n\r\n**Actual behavior**\r\n\r\n- always reports changed for all packages"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/185204774","html_url":"https://github.com/ansible/ansible-modules-core/issues/3055#issuecomment-185204774","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3055","id":185204774,"user":{"login":"mgedmin","id":159967,"avatar_url":"https://avatars.githubusercontent.com/u/159967?v=3","gravatar_id":"","url":"https://api.github.com/users/mgedmin","html_url":"https://github.com/mgedmin","followers_url":"https://api.github.com/users/mgedmin/followers","following_url":"https://api.github.com/users/mgedmin/following{/other_user}","gists_url":"https://api.github.com/users/mgedmin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgedmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgedmin/subscriptions","organizations_url":"https://api.github.com/users/mgedmin/orgs","repos_url":"https://api.github.com/users/mgedmin/repos","events_url":"https://api.github.com/users/mgedmin/events{/privacy}","received_events_url":"https://api.github.com/users/mgedmin/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T13:31:46Z","updated_at":"2016-02-17T13:31:46Z","body":"This may be more difficult than I originally thought, since `pip install -U` doesn't support anything like `--dry-run`.\r\n\r\n`pip list --outdated` might help produce a better approximation rather than always assuming that changed will be true.  Note that `pip install -U package` upgrades not just the package but also all of its dependencies, so instead of checking whether `package` shows up in `pip list --outdated` we should check whether `pip list --outdated` lists any outdated packages."}}