forked from avanov/ansible-galaxy-pyenv
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
|
||
tasks: | ||
- name: "Include staticdev.pyenv" | ||
include_role: | ||
ansible.builtin.include_role: | ||
name: "staticdev.pyenv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "ansible-role-pyenv" | ||
version = "2.6.1" | ||
version = "2.6.2" | ||
description = "Ansible role to install pyenv." | ||
authors = ["staticdev <[email protected]>"] | ||
license = "MIT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
--- | ||
- name: Ensure apt cache is up to date | ||
apt: | ||
ansible.builtin.apt: | ||
update_cache: true | ||
cache_valid_time: 3600 | ||
become: true | ||
|
||
- name: Install development packages necessary for building Python | ||
apt: | ||
ansible.builtin.apt: | ||
pkg: "{{ pyenv_debian_packages }}" | ||
state: present | ||
become: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
--- | ||
- name: Create folder for custom facts | ||
file: | ||
ansible.builtin.file: | ||
path: /etc/ansible/facts.d | ||
state: directory | ||
|
||
- name: Copy over check-configure-options.py | ||
template: | ||
ansible.builtin.template: | ||
src: templates/check-configure-options.py.j2 | ||
dest: /etc/ansible/facts.d/check-configure-options.py | ||
owner: "{{ pyenv_owner }}" | ||
group: "{{ pyenv_owner_group }}" | ||
mode: "0755" | ||
|
||
- name: Copy over python_check fact file | ||
template: | ||
ansible.builtin.template: | ||
src: templates/pyenv_python_installations.fact.j2 | ||
dest: /etc/ansible/facts.d/pyenv_python_installations.fact | ||
owner: "{{ pyenv_owner }}" | ||
group: "{{ pyenv_owner_group }}" | ||
mode: "0755" | ||
|
||
- name: Reload setup to gather custom facts | ||
setup: | ||
ansible.builtin.setup: | ||
filter: ansible_local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,71 @@ | ||
--- | ||
- name: Install PyEnv | ||
git: | ||
ansible.builtin.git: | ||
repo: https://github.com/pyenv/pyenv.git | ||
dest: "{{ pyenv_path }}" | ||
update: "{{ pyenv_update_git_install }}" | ||
|
||
- name: Install PyEnv-virtualenv plugin | ||
git: | ||
ansible.builtin.git: | ||
repo: https://github.com/yyuu/pyenv-virtualenv.git | ||
dest: "{{ pyenv_path }}/plugins/pyenv-virtualenv" | ||
update: "{{ pyenv_update_git_install }}" | ||
|
||
- name: Install PyEnv-update plugin | ||
git: | ||
ansible.builtin.git: | ||
repo: https://github.com/pyenv/pyenv-update.git | ||
dest: "{{ pyenv_path }}/plugins/pyenv-update" | ||
update: "{{ pyenv_update_git_install }}" | ||
when: pyenv_update | ||
|
||
- name: Install .pyenvrc | ||
template: | ||
ansible.builtin.template: | ||
src: ".pyenvrc.j2" | ||
dest: "{{ pyenv_path }}/.pyenvrc" | ||
owner: "{{ pyenv_owner }}" | ||
mode: "0644" | ||
|
||
- name: "Load pyenv env variables in {{ pyenv_setting_path }}" | ||
lineinfile: dest="{{ pyenv_setting_path }}" | ||
ansible.builtin.lineinfile: dest="{{ pyenv_setting_path }}" | ||
regexp="\.pyenvrc$" | ||
line="source {{ pyenv_path }}/.pyenvrc" | ||
state=present | ||
create=yes | ||
|
||
- name: "Add pyenv autocomplete in {{ pyenv_setting_path }}" | ||
lineinfile: dest="{{ pyenv_setting_path }}" | ||
ansible.builtin.lineinfile: dest="{{ pyenv_setting_path }}" | ||
regexp="pyenv\.bash$" | ||
line="source {{ pyenv_path }}/completions/pyenv.bash" | ||
state=present | ||
when: pyenv_enable_autocompletion | ||
|
||
- name: Update Pyenv interpreter list | ||
shell: . {{ pyenv_path }}/.pyenvrc && pyenv update | ||
ansible.builtin.shell: . {{ pyenv_path }}/.pyenvrc && pyenv update | ||
when: pyenv_update | ||
|
||
- name: Uninstall existing Python interpreters w/ wrong compilation flags | ||
shell: ". {{ pyenv_path }}/.pyenvrc && pyenv uninstall -f {{ item }}" | ||
ansible.builtin.shell: ". {{ pyenv_path }}/.pyenvrc && pyenv uninstall -f {{ item }}" | ||
args: | ||
removes: "{{ pyenv_path }}/versions/{{ item }}/bin/python" | ||
loop: "{{ ansible_local['pyenv_python_installations']['to_reinstall'] | default([]) }}" | ||
when: pyenv_uninstall_python_w_wrong_configure_opts | ||
|
||
- name: "Install Python interpreters {{ pyenv_python_versions }}" | ||
shell: ". {{ pyenv_path }}/.pyenvrc && pyenv install {{ item }}" | ||
ansible.builtin.shell: ". {{ pyenv_path }}/.pyenvrc && pyenv install {{ item }}" | ||
environment: | ||
PYTHON_CONFIGURE_OPTS: "{{ pyenv_python_configure_opts }}" | ||
args: | ||
creates: "{{ pyenv_path }}/versions/{{ item }}/bin/python" | ||
with_items: "{{ pyenv_python_versions }}" | ||
|
||
- name: Create virtual environments | ||
shell: | ||
ansible.builtin.shell: | ||
. {{ pyenv_path }}/.pyenvrc && pyenv virtualenv {{ item.py_version }} {{ item.venv_name }} | ||
creates="{{ pyenv_path }}/versions/{{ item.py_version }}/envs/{{ item.venv_name }}/bin/python" | ||
with_items: "{{ pyenv_virtualenvs }}" | ||
|
||
- name: "Set pyenv global {{ pyenv_global }}" | ||
shell: . {{ pyenv_path }}/.pyenvrc && pyenv global {{ pyenv_global | join(' ') }} && pyenv rehash | ||
ansible.builtin.shell: . {{ pyenv_path }}/.pyenvrc && pyenv global {{ pyenv_global | join(' ') }} && pyenv rehash | ||
args: | ||
creates: "{{ pyenv_path }}/version" | ||
when: pyenv_global is defined |