-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-python311.yaml
70 lines (61 loc) · 1.85 KB
/
install-python311.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
- name: python 3.11 install
hosts: python
become: yes
serial: 1
vars:
pythonversion: 3.11.4
tasks:
- name: apt-get update
ansible.builtin.apt:
update_cache: yes
- name: Install a list of packages
ansible.builtin.apt:
pkg:
- build-essential
- gdb
- lcov
- pkg-config
- libbz2-dev
- libffi-dev
- libgdbm-dev
- libgdbm-compat-dev
- liblzma-dev
- libncurses5-dev
- libreadline6-dev
- libsqlite3-dev
- libssl-dev
- lzma
- lzma-dev
- tk-dev
- uuid-dev
- zlib1g-dev
- name: delete directory
file:
path: "/usr/local/src/Python-{{ pythonversion }}"
state: absent
- name: delete python file
file:
path: "/usr/local/src/Python-{{ pythonversion }}.tgz"
state: absent
- name: download python
ansible.builtin.get_url:
url: https://www.python.org/ftp/python/{{ pythonversion }}/Python-{{ pythonversion }}.tgz
dest: /usr/local/src/Python-{{ pythonversion }}.tgz
- name: extract python file
ansible.builtin.unarchive:
src: /usr/local/src/Python-{{ pythonversion }}.tgz
dest: /usr/local/src/
remote_src: yes
- name: configure python
shell: ./configure --enable-optimizations
args:
chdir: /usr/local/src/Python-{{ pythonversion }}
- name: make python with {{ ansible_processor_vcpus }} CPUs
shell: make -j{{ ansible_processor_vcpus }}
args:
chdir: /usr/local/src/Python-{{ pythonversion }}
- name: make altinstall python with {{ ansible_processor_vcpus }} CPUs
shell: make -j{{ ansible_processor_vcpus }} altinstall
args:
chdir: /usr/local/src/Python-{{ pythonversion }}