Files
soupclown/ansible/roles/dietpi/tasks/pyenv.yaml
T

59 lines
1.4 KiB
YAML

- name: Install build environment
become: true
apt:
update_cache: true
cache_valid_time: 3600
pkg:
- git
- build-essential
- libssl-dev
- zlib1g-dev
- libbz2-dev
- libreadline-dev
- libsqlite3-dev
- curl
- libncursesw5-dev
- xz-utils
- tk-dev
- libxml2-dev
- libxmlsec1-dev
- libffi-dev
- liblzma-dev
- python3-pip
- python3-venv
- name: Check if pyenv is installed
stat:
path: /root/.pyenv
register: pyenv_installed
- name: Download pyenv install script
get_url:
url: https://pyenv.run
dest: /tmp/install_pyenv.sh
mode: 0755
when: not pyenv_installed.stat.exists
- name: Run install script
shell: /tmp/install_pyenv.sh
when: not pyenv_installed.stat.exists
- name: Add pyenv to .bashrc
blockinfile:
dest: "/home/dietpi/.bashrc"
block: |
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
marker: '# {mark} ANSIBLE MANAGED BLOCK - pyenv'
create: yes
- name: Add pyenv to .profile
blockinfile:
dest: "/home/dietpi/.profile"
block: |
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
marker: '# {mark} ANSIBLE MANAGED BLOCK - pyenv'
create: yes