/ansible-role-pyenv

Ansible role to install pyenv.

Primary LanguageShellMIT LicenseMIT

Ansible role: Pyenv

Tests

Ansible Galaxy role for pyenv on Debian / Ubuntu / RedHat / OSX.

Install it with the following command:

$ ansible-galaxy install staticdev.pyenv

Requirements

None.

Role Variables

Here is the list of all variables and their default values:

  • pyenv_version: "HEAD" - check https://github.com/pyenv/pyenv/releases
  • pyenv_virtualenv_version: "HEAD" - check https://github.com/pyenv/pyenv-virtualenv/releases
  • pyenv_update_version: "HEAD" - usually do not have releases but one can specify a commit hash
  • pyenv_env: "user" (should be either "user" or "system")
  • pyenv_path: "{% if pyenv_env == 'user' %}{{ ansible_env.HOME }}/pyenv{% else %}/usr/local/pyenv{% endif %}"
  • pyenvrc_path: "{{ pyenv_path }}"
  • pyenv_owner: "{{ ansible_facts.user_id }}"
  • pyenv_owner_group: "{{ pyenv_owner }}"
  • pyenv_python_versions: [3.11.4]
  • pyenv_virtualenvs: [{ venv_name: latest, py_version: 3.11.4 }]
  • pyenv_global: [3.11.4]
  • pyenv_update_git_install: true (get latest pyenv from git)
  • pyenv_enable_autocompletion: false
  • pyenv_enable_virtualenvs: true
  • pyenv_shellrc_file "{% if pyenv_env == 'user' %}~/.bashrc{% else %}/etc/profile.d/pyenv.sh{% endif %}"

Dependencies

None.

Example Playbook

- hosts: servers
  roles:
    - role: staticdev.pyenv
      pyenv_version: "v2.3.9"
      pyenv_virtualenv_version: "v1.1.5"
      pyenv_update_version: "810db78"
      pyenv_shellrc_file: "{{ ansible_env.HOME }}/.shrc"
      pyenv_path: "{{ ansible_env.HOME }}/.pyenv"
      pyenvrc_path: "{{ ansible_env.HOME }}"
      pyenv_owner: "{{ instance_owner }}"
      pyenv_global:
        - 3.11.4
        - 3.10.12
      pyenv_enable_autocompletion: false
      pyenv_python_versions:
        - 3.11.4
        - 3.10.12
      pyenv_virtualenvs:
        - venv_name: latest_v311
          py_version: 3.11.4
        - venv_name: latest_v310
          py_version: 3.10.12

License

Distributed under the terms of the MIT license, Ansible role Pyenv is free and open source software.

Author Information

staticdev. Heavily based on Maxim Avanov's avanov.pyenv