--- - name: "Include OS-specific variables" ansible.builtin.include_vars: "{{ ansible_os_family | lower }}.yml" - name: "Download uv installer" ansible.builtin.get_url: url: "https://astral.sh/uv/install.sh" dest: "/tmp/install_uv.sh" mode: "0755" - name: "Run uv installer" ansible.builtin.command: cmd: "/tmp/install_uv.sh" args: creates: "{{ ansible_env.HOME }}/.local/bin/uv" - name: "Add uv to shell profile" ansible.builtin.blockinfile: path: "{{ ansible_env.HOME }}/.bashrc" state: "present" prepend_newline: true append_newline: true marker: "# ==== {mark} ANSIBLE UV PYTHON CONFIG" block: | if command -v uv 1>/dev/null 2>&1; then export PATH="$HOME/.local/bin:$PATH" fi - name: "Install python versions" ansible.builtin.command: cmd: "uv python install {{ item }}" args: creates: "{{ ansible_env.HOME }}/.local/share/uv/python/cpython-{{ item }}*/bin/python{{ item }}" loop: "{{ python_versions }}" when: python_versions | length > 0