ansible module to run pyenv command.
https://galaxy.ansible.com/suzuki-shunsuke/pyenv-module/
- This module doesn't support the check mode
- GenericLinux
- MacOSX
We test this module in
- Ubuntu 16.04 (Vagrant, Virtualbox)
- CentOS 7.3 (Vagrant, Virtualbox)
- MaxOS Sierra 10.12.5
- pyenv
- python build dependencies
- pyenv-virtualenv: required if you want to run
virtualenv
orvirtualenvs
subcommand
If you want to install pyenv and python build dependencies with ansible role, we recommend the suzuki-shunsuke.pyenv. And if you want to install pyenv-virtualenv with ansible role, we recommend the suzuki-shunsuke.pyenv-virtualenv.
$ pyenv install [-s] [-f] <version>
$ pyenv uninstall -f <version>
$ pyenv install -l
$ pyenv versions [--bare]
$ pyenv global
$ pyenv global <versions>
$ pyenv virtualenv [-f|--force] [version] <virtualenv-name>
$ pyenv virtualenvs [--bare] [--skip-aliases]
$ ansible-galaxy install suzuki-shunsuke.pyenv-module
# playbook.yml
- hosts: default
roles:
# After you call this role, you can use this module.
- suzuki-shunsuke.pyenv-module
In addition to this document, please see pyenv command reference and the output of pyenv help <command>
command also.
name | type | required | default | choices / example | description |
---|---|---|---|---|---|
subcommand | str | no | install | [install, uninstall, versions, global, virtualenvs, virtualenv] | |
pyenv_root | str | no | ~/.pyenv | If the environment variable "PYENV_ROOT" is not set, this option is required | |
expanduser | bool | no | yes | By default the environment variable PYENV_ROOT and "pyenv_root" option are filtered by os.path.expanduser |
parameter | type | required | default | choices / example | description |
---|---|---|---|---|---|
version | str | no | 3.6.1 | ||
list | bool | no | no | -l option | |
skip_existing | bool | no | yes | -s option | |
force | bool | no | no | -f option |
Either "version" or "list" option is required. If the "list" option is set, the return value of that task has "versions" field.
parameter | type | required | default | choices / example | description |
---|---|---|---|---|---|
version | str | yes | 2.7.13 |
parameter | type | required | default | choices | description |
---|---|---|---|---|---|
versions | list | no |
The return value of the "global" subcommand has "versions" field.
parameter | type | required | default | choices | description |
---|---|---|---|---|---|
bare | bool | no | yes |
The return value of the "versions" subcommand has "versions" field.
parameter | type | required | default | choices | description |
---|---|---|---|---|---|
skip_aliases | bool | no | yes | ||
bare | bool | no | yes |
The return value of the "virtualenvs" subcommand has "virtualenvs" field.
parameter | type | required | default | example | description |
---|---|---|---|---|---|
force | bool | no | no | ||
version | str | yes | 2.7.13 | ||
virtualenv_name | str | yes | ansible |
- name: pyenv install -s 3.6.1
pyenv:
version: 3.6.1
pyenv_root: "~/.pyenv"
- name: pyenv install -f 3.6.1
pyenv:
version: 3.6.1
pyenv_root: "~/.pyenv"
force: yes
- name: pyenv uninstall -f 2.6.9
pyenv:
subcommand: uninstall
version: 2.6.9
pyenv_root: "~/.pyenv"
- name: pyenv global 3.6.1
pyenv:
subcommand: global
versions:
- 3.6.1
pyenv_root: "~/.pyenv"
- name: pyenv global
pyenv:
subcommand: global
pyenv_root: "~/.pyenv"
register: result
- debug:
var: result.versions
- name: pyenv install -l
pyenv:
list: yes
pyenv_root: "{{ansible_env.HOME}}/.pyenv"
register: result
- debug:
var: result.versions
- name: pyenv versions --bare
pyenv:
subcommand: versions
pyenv_root: "{{ansible_env.HOME}}/.pyenv"
register: result
- debug:
var: result.versions
- name: pyenv virtualenvs --skip-aliases --bare
pyenv:
subcommand: virtualenvs
pyenv_root: "~/.pyenv"
register: result
- debug:
var: result.virtualenvs
- name: pyenv virtualenv --force 2.7.13 ansible
pyenv:
subcommand: virtualenv
pyenv_root: "~/.pyenv"
version: 2.7.13
virtualenv_name: ansible
force: yes
See CHANGELOG.md.
- Vagrant
- Ansible
- Node.js
- yarn
$ yarn install
$ cd tests
$ ansible-galaxy install -r roles.yml
$ cd tests
$ vagrant up --provision