Skip to content

Instantly share code, notes, and snippets.

@widnyana
Created February 16, 2016 10:43
Show Gist options
  • Select an option

  • Save widnyana/eb43a3bf30f9501ce137 to your computer and use it in GitHub Desktop.

Select an option

Save widnyana/eb43a3bf30f9501ce137 to your computer and use it in GitHub Desktop.
ansible virtualenv trick
- template: src=templates/venv_exec.j2 dest={{ om_venv_path }}/exec mode=755
- command: "{{ om_venv_path }}/exec pip install -U pip"
- command: "{{ om_venv_path }}/exec which pip"
changed: [127.0.0.1] => {"changed": true, "cmd": ["/home/vagrant/.virtualenv/om_prod/exec", "pip", "install", "-U", "pip"], "delta": "0:00:00.981062", "end": "2016-02-16 10:41:31.248946", "rc": 0, "start": "2016-02-16 10:41:30.267884", "stderr": "/home/vagrant/.virtualenv/om_prod/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.\n SNIMissingWarning\n/home/vagrant/.virtualenv/om_prod/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.\n InsecurePlatformWarning\n/home/vagrant/.virtualenv/om_prod/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.\n InsecurePlatformWarning", "stdout": "Requirement already up-to-date: pip in ./.virtualenv/om_prod/lib/python2.7/site-packages", "warnings": []}
<snip>
changed: [127.0.0.1] => {"changed": true, "cmd": ["/home/vagrant/.virtualenv/om_prod/exec", "which", "pip"], "delta": "0:00:00.005221", "end": "2016-02-16 10:41:31.415744", "rc": 0, "start": "2016-02-16 10:41:31.410523", "stderr": "", "stdout": "/home/vagrant/.virtualenv/om_prod/bin/pip", "warnings": []}
#!/bin/bash
source {{ om_venv_path }}/bin/activate
$@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment