Move all shared into this new repo
This commit is contained in:
14
code/pyenv/files/bin/pyenv-fix-permissions.sh
Executable file
14
code/pyenv/files/bin/pyenv-fix-permissions.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fixes pyenv permissions after installing new versions
|
||||
# Even though I setfacl specifically on this dir, installing new versions
|
||||
# forces a mask on the pyenv/versions/xyz folder, so this script fixes that
|
||||
# and forces permissions back to my standard
|
||||
# mReschke 2019-04-19
|
||||
|
||||
path=/usr/local/lib/pyenv
|
||||
chown toor:staff $path -R
|
||||
chmod 2775 $path
|
||||
find $path -type d -exec chmod 2775 {} \;
|
||||
setfacl -R -d -m user::rwx,group::rwx $path
|
||||
|
||||
19
code/pyenv/files/profile.d/pyenv.sh
Normal file
19
code/pyenv/files/profile.d/pyenv.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
# Pyenv location
|
||||
pyenv=/usr/local/lib/pyenv
|
||||
export PYENV_ROOT=$pyenv
|
||||
|
||||
# Makes pipenv obey global or local pyenv!
|
||||
PIPENV_PYTHON=$pyenv/shims/python
|
||||
|
||||
PATH="$PYENV_ROOT/bin:$PATH"
|
||||
|
||||
# Python penv, must be AFTER $PATH is set as it changes it
|
||||
if command -v pyenv 1>/dev/null 2>&1; then
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
|
||||
# Python aliases
|
||||
alias pv='echo "Version:" && python --version && echo && echo "Interpreter Path:" && python -c "import sys;print(sys.prefix)" && echo && echo "Paths:" && python -c "import sys;print(sys.path);"'
|
||||
alias activate='source env/bin/activate && pv'
|
||||
alias pips='pipenv shell && echo "pipenv shell has been deactivated" && echo && pv'
|
||||
54
code/pyenv/tasks/install-pyenv.yml
Normal file
54
code/pyenv/tasks/install-pyenv.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
# Pyenv requires compilers and build tools
|
||||
|
||||
# Debian 9
|
||||
- name: Installing build-essential and pyenv dependencies
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name:
|
||||
- build-essential
|
||||
- checkinstall
|
||||
- libreadline-gplv2-dev
|
||||
- libncursesw5-dev
|
||||
- libssl-dev
|
||||
- libsqlite3-dev
|
||||
- tk-dev
|
||||
- libgdbm-dev
|
||||
- libc6-dev
|
||||
- libbz2-dev
|
||||
|
||||
# Debian 10
|
||||
- name: Installing build-essential and pyenv dependencies
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name:
|
||||
- build-essential
|
||||
- libreadline-gplv2-dev
|
||||
- libncursesw5-dev
|
||||
- libssl-dev
|
||||
- libsqlite3-dev
|
||||
- tk-dev
|
||||
- libgdbm-dev
|
||||
- libc6-dev
|
||||
- libbz2-dev
|
||||
- libffi-dev
|
||||
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"
|
||||
|
||||
|
||||
|
||||
# Install pyenv using git clone
|
||||
- name: Installing pyenv using git clone
|
||||
git:
|
||||
repo: https://github.com/pyenv/pyenv.git
|
||||
dest: /usr/local/lib/pyenv
|
||||
depth: 1
|
||||
|
||||
# Set users and permissions
|
||||
# There is also a files/bin/pyenv-fix-permissions.sh that mirror the below
|
||||
# which you can run manually after you install a new version (pyenv sets mask and ignores setfacl)
|
||||
- command: chown toor:staff /usr/local/lib/pyenv -R
|
||||
- command: chmod 2775 /usr/local/lib/pyenv
|
||||
- command: find /usr/local/lib/pyenv -type d -exec chmod 2775 {} \;
|
||||
- command: setfacl -R -d -m user::rwx,group::rwx /usr/local/lib/pyenv
|
||||
25
code/pyenv/tasks/main.yml
Normal file
25
code/pyenv/tasks/main.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
# Install pyenv
|
||||
- include_tasks: install-pyenv.yml
|
||||
|
||||
# Copy scripts to /usr/local/bin
|
||||
- name: Copying scripts to /usr/local/bin
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: /usr/local/bin/
|
||||
owner: toor
|
||||
group: staff
|
||||
mode: 0775
|
||||
with_fileglob:
|
||||
- bin/*
|
||||
|
||||
# Copy profiles to /etc/profile.d/
|
||||
- name: Copying profiles to /etc/profile.d
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: /etc/profile.d/
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
with_fileglob:
|
||||
- profile.d/*
|
||||
Reference in New Issue
Block a user