Servers-for-Hackers / the-book

Servers for Hackers eBook Issues
63 stars 5 forks source link

Ansible installation with virtualenv contradicts virtualenv #83

Open mvk opened 6 years ago

mvk commented 6 years ago

hi, I pointed an unexperienced candidate at your tutorial: https://serversforhackers.com/c/an-ansible2-tutorial

Here are the takeouts:

NOTE: It's not a "broken instructions", but rather "bad practice" instructions feedback.

At some point the page explains how to setup Ansible inside a virtualenv. It instructs the reader to install virtualenv as user root using pip.

  1. isolation: One of the MAIN ideas is to leave system python environment untainted. "untainted" is very critical, when you install packages with pip, as root, usually they taint system python with /usr/local/ stuff installed, and thus, to adhere the idea of keeping maximum isolation, you must install virtualenv package using OS, not pip. After it's installed you can start running virtualenv using regular user.
  2. development packages: Now, when you're installing using pip, without specifying wheel or source, you absolutely need -dev packages, b/c some packages ansible needs require compilation (crypto mainly), so you also need openssl development packages and the c compilers, etc.
  3. virtualenvwrapper: Also, I would recommend virtualenvwrapper, which makes usage of virtualenv a bit more intuitive for the beginners, (IMHO). It also out of the box makes an opinionated organization of virtualenvs, so they are available for any project.

BIG Thanks for the content!

fideloper commented 6 years ago

Thanks for the feedback! That all makes sense 👍