Python installeren met de Windows-rol van het C2 Platform
Voorbeeld van het installeren van Python 3.13 met behulp van de Windows Ansible-collectie
c2platform.wincore
van het C2 Platform.Categories:
Projects:
c2platform/phx/ansible
,
c2platform.wincore
Het volgende voorbeeld maakt deel uit van het PHX-inventarisproject
c2platform/phx/ansible
,
gevestigd in het bestand group_vars/win_devtop/python.yml
. Het maakt gebruik van de win_resources
variabele uit de Ansible-collectie van het C2 Platform
c2platform.wincore
om Python te downloaden en te installeren.
group_vars/win_devtop/python.yml
2px_python_path: "{{ px_apps_dir }}/Python313"
3win_resources:
4 1_python:
5 - name: Download Python
6 type: win_get_url
7 url: https://www.python.org/ftp/python/3.13.3/python-3.13.3-amd64.exe
8 dest: "{{ px_download_temp_dir['path'] }}/python-3.13.3-amd64.exe"
9 checksum: be3264daeb8c5e08365492dd02908cfa
10 checksum_algorithm: md5
11 - name: Install Python
12 type: win_package
13 path: "{{ px_download_temp_dir['path'] }}/python-3.13.3-amd64.exe"
14 arguments: '/quiet InstallAllUsers=1 PrependPath=1 TargetDir="{{ px_python_path | c2platform.core.replace_slashes }}"'
15 # product_id: Python 3.13.3 Core Interpreter (64-bit) # TODO should work but does not work!?
16 creates_path: "{{ px_python_path }}"
Verificatie
Om de installatie te verifiëren, maak verbinding met de doel-Windows-machine en controleer de Python- en pip-versies.
vagrant ssh pxd-win-devtop
C:\Users\vagrant>python --version
Python 3.13.3
C:\Users\vagrant>pip --version
pip 25.0.1 from D:\Apps\Python313\Lib\site-packages\pip (python 3.13)
Feedback
Was deze pagina nuttig?
Fijn om te horen! Vertel ons alstublieft hoe we kunnen verbeteren.
Jammer om dat te horen. Vertel ons alstublieft hoe we kunnen verbeteren.
Laatst gewijzigd 2025.09.01: guide dev vault final version PHX-138 (82e3bb6)