title: How to correctly upgrade pip using ansible?
body: <h2>Goal and Environment</h2>
  
  <p>I am using ansible against <strong>Ubuntu 16.04</strong> . 
  The ultimate goal is to use <code>mongodb_user</code> module. 
  This requires <code>pymongo</code>, so this require <code>python-pip</code></p>
  
  <h2>What am I doing</h2>
  
  <pre><code>- name: Package prerequisites for pymongo ansible module
    apt:
      force_apt_get: yes
      name: ['python-pip', 'python-setuptools']
      install_recommends: no
      state: present
    become: true
    tags:
      - mongo
    register: output
  
  - name: Upgrade pip to latest vesion
    pip:
      name: pip
      extra_args: --upgrade
    register: output
  
  - debug:
      var: output    
  </code></pre>
  
  <h2>The problem</h2>
  
  <p>This is actual output; please note:</p>
  
  <ul>
  <li>seems <code>pip</code> ignores upgrade instructions </li>
  <li>the <code>/usr/bin/pip2</code> binary , while I was expecte</li>
  </ul>
  
  <pre><code>    "output": {
          "changed": true, 
          "cmd": [
              "/usr/bin/pip2", 
              "install", 
              "--upgrade", 
              "pip"
          ], 
          "failed": false, 
          "name": [
              "pip"
          ], 
          "requirements": null, 
          "state": "present", 
          "stderr": "You are using pip version 8.1.1, however version 18.1 is available.\nYou should consider upgrading via the 'pip install --upgrade pip' command.\n", 
          "stderr_lines": [
              "You are using pip version 8.1.1, however version 18.1 is available.", 
              "You should consider upgrading via the 'pip install --upgrade pip' command."
          ], 
          "stdout": "Collecting pip\n  Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl\nInstalling collected packages: pip\nSuccessfully installed pip-8.1.1\n", 
          "stdout_lines": [
              "Collecting pip", 
              "  Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl", 
              "Installing collected packages: pip", 
              "Successfully installed pip-8.1.1"
          ], 
          "version": null, 
          "virtualenv": null
      }
  </code></pre>
  
  <p>The strange thing is that, from command line I got</p>
  
  <pre><code>$ /usr/bin/pip2 -V
  pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
  
  $ /home/mirko/.local/bin/pip -V
  pip 18.1 from /home/mirko/.local/lib/python2.7/site-packages/pip (python 2.7)
  </code></pre>
  
  <h2>A try</h2>
  
  <p>I tried to <em>manually</em> upgrade pip after install of <code>python-pip</code> and got another strange thing: pip do not want to uninstall old pip...</p>
  
  <pre><code>sudo pip install pip --upgrade
  [sudo] password for mirko: 
  The directory '/home/mirko/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
  The directory '/home/mirko/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
  Collecting pip
    Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
      100% |████████████████████████████████| 1.3MB 1.2MB/s 
  Installing collected packages: pip
    Found existing installation: pip 8.1.1
      Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
  </code></pre>
  
  <h2>Question(s)</h2>
  
  <p>What is the right way to use pip with ansible vs an Ubuntu 16.04?</p>
  
  <p>Must/Can I force ansible to use "my" pip?</p>
  
  <p>Must/Can I deinstall the "wrong" pip?</p>
  
  <p>Have I done something wrong to create this dual-version problem?</p>