kota65535.pyenv
kota65535.pyenv
Ansible role for installing pyenv and pyenv-virtualenv on RHEL and Ubuntu.
Install it with the following command:
$ ansible-galaxy install kota65535.pyenv
Dependencies
- ansible >= 2.2.1
Role Variables
pyenv_users- Array of usernames for multiuser install. User must be present in the system.pyenv_python_versions- Python versions to be installedpyenv_virtualenvs- Dict of virtualenvs created for each users. Following keys should be set.venv_name: the name of the virtualenvpy_version: python version used by the virtualenv
pyenv_root- Install path of pyenvpyenv_profile_path- Install path of pyenv initialization script
You can use X as the latest version number to specify python version (ex. 3.5.X).
The default values are as follows:
pyenv_python_versions: []
pyenv_virtualenvs: []
pyenv_root: "~/.pyenv"
pyenv_repo: "https://github.com/yyuu/pyenv.git"
pyenv_virtualenv_repo: "https://github.com/yyuu/pyenv-virtualenv.git"
Example Playbooks
1. Personal setup
- Install pyenv for me only
- Install python 2.7.12 and the latest version of 3.5
- Create virtualenvs with the installed pythons
- Add lines to
~/.bashrcto initialize pyenv
- hosts: all
vars:
pyenv_python_versions:
- 2.7.12
- 3.5.X
pyenv_virtualenvs:
- venv_name: the-conventional
py_version: 2.7.12
- venv_name: the-latest
py_version: 3.5.X
pyenv_profile_path: ~/.bashrc
roles:
- kota65535.pyenv
2. Multiple users, global profile
- Install pyenv for users
test01andtest02 - Install python 2.7.12
- Crerate
/etc/profile.d/pyenv.shto initialize pyenv for all users
- hosts: all
vars:
pyenv_python_versions:
- 2.7.12
pyenv_users:
- test01
- test02
pyenv_profile_path: /etc/profile.d/pyenv.sh
pyenv_profile_owner: root
roles:
- kota65535.pyenv
3. Multiple users, personal profiles
- Install pyenv for users
test01andtest02 - Install python 2.7.12
- Add lines to
~/.bashrcof each users to initialize pyenv
- hosts: all
vars:
pyenv_python_versions:
- 2.7.12
pyenv_users:
- test01
- test02
pyenv_profile_path: ~/.bashrc
roles:
- kota65535.pyenv
License
MIT
Author Information
Tomohiko Ozawa (https://github.com/kota65535)
Install
ansible-galaxy install kota65535.pyenvLicense
mit
Downloads
211
Owner
Server side & infra engineer
