Ansible Galaxy role for pyenv on Ubuntu / RedHat / OSX.
Install it with the following command:
$ ansible-galaxy install avanov.pyenvNone
Here is the list of all variables and their default values:
pyenv_env: "user"(should be either"user"or"system")pyenv_path: "{% if pyenv_env == 'user' %}{{ ansible_env.HOME }}/pyenv{% else %}/usr/local/pyenv{% endif %}"pyenv_owner: "{{ ansible_env.USER }}"pyenv_python_versions: ["3.4.1"]pyenv_virtualenvs: [{ venv_name: "latest", py_version: "3.4.1" }]pyenv_global: "3.4.1"pyenv_update_git_install: nopyenv_enable_autocompletion: nopyenv_setting_path: "{% if pyenv_env == 'user' %}~/.bashrc{% else %}/etc/profile.d/pyenv.sh{% endif %}"
None
- hosts: servers
  roles:
     - role: avanov.pyenv
       pyenv_path: "{{ home }}/pyenv"
       pyenv_owner: "{{ instance_owner }}"
       pyenv_global: "3.6.5"
       pyenv_update_git_install: no
       pyenv_enable_autocompletion: no
       pyenv_python_versions:
         - "3.6.5"
         - "3.4.1"
         - "2.7.8"
       pyenv_virtualenvs:
         - venv_name: "latest_v3"
           py_version: "3.4.1"
         - venv_name: "latest_v2"
           py_version: "2.7.8"
MIT
Maxim Avanov (https://maximavanov.com/)