-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for latest system python to pyenv and python-workbench (#122
) * role pip: minor refactor * role pyenv: support system-latest * python-workbench: support system-latest * Update pyenv and python-workbench docs
- Loading branch information
Showing
10 changed files
with
117 additions
and
10 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
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
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
package: | ||
name: python3-pip | ||
state: present | ||
when: ansible_pkg_mgr == 'apt' |
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,2 +1,9 @@ | ||
--- | ||
pyenv_default_python: "system" | ||
pyenv_system_python_latest_versions: | ||
Ubuntu: | ||
'20.04': '3.9' | ||
'22.04': '3.11' | ||
'23.04': '3.11' | ||
'23.10': '3.12' | ||
'24.04': '3.12' |
10 changes: 10 additions & 0 deletions
10
playbooks/roles/pyenv/molecule/pyenv-system_python/converge.yml
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
gather_facts: true | ||
tasks: | ||
- name: Testing userspace pyenv role | ||
include_role: | ||
name: pyenv | ||
vars: | ||
pyenv_default_python: 'system-latest' |
10 changes: 10 additions & 0 deletions
10
playbooks/roles/pyenv/molecule/pyenv-system_python/molecule.yml
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
provisioner: | ||
name: ansible | ||
playbooks: | ||
converge: ./converge.yml | ||
prepare: ../default/prepare.yml | ||
env: | ||
ANSIBLE_ROLES_PATH: ../../../ | ||
ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3 | ||
role_name_check: 1 |
34 changes: 34 additions & 0 deletions
34
playbooks/roles/pyenv/molecule/pyenv-system_python/verify.yml
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: true | ||
tasks: | ||
- name: Get all runonce files | ||
find: | ||
paths: /etc/runonce.d | ||
recurse: no | ||
register: found_scripts | ||
|
||
- name: Run runonce scripts | ||
ansible.builtin.command: su -c "{{ item.path }}" - testuser | ||
with_items: "{{ found_scripts.files }}" | ||
|
||
- name: Test pyenv | ||
ansible.builtin.shell: su -c "bash -ic 'pyenv global'" - testuser | ||
register: pyenv_global | ||
|
||
- name: Test python version | ||
ansible.builtin.shell: su -c "bash -ic 'python --version'" - testuser | ||
register: python_version | ||
|
||
- name: Set expected python versions | ||
set_fact: | ||
expected_python_version: | ||
'20.04': '3.9' | ||
'22.04': '3.11' | ||
|
||
- name: Assert correct global python version | ||
ansible.builtin.assert: | ||
that: | ||
- "pyenv_global.stdout_lines[-1] == 'system-latest'" | ||
- "expected_python_version[ansible_distribution_version] in python_version.stdout_lines[-1]" |
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