Manage Python versions and installations using the uv Python package manager.
- Ansible
2.12or higher. uvinstalled and available onPATHanduvversion ≥0.8.0.
Install via Ansible Galaxy:
ansible-galaxy collection install mriamah.uvThis collection provides tools to manage Python versions using the uv python subcommand from the Astral uv package manager.
- Installs, uninstalls, and upgrades Python versions.
- Supports three states:
present– ensures a specific Python version is installed.absent– removes specified Python version.latest– installs the latest patch version for a minor release.
- Returns facts for further playbook usage:
python_versions(list) - list of versions changed.python_paths(list) - List of installation paths of Python versions changed.
- Designed for Ansible 2.12+ and uv ≥ 0.8.0
- All module operations are idempotent and support
check_mode.
- name: Install Python 3.12.3
mriamah.uv.python:
version: 3.12.3
state: present- name: Remove Python 3.12
mriamah.uv.python:
version: 3.12
state: absent- name: Install latest patch for 3.12
mriamah.uv.python:
version: 3.12
state: latestGNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)