65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
- name: 'check for {{ item.binary }} binary'
|
|
command: 'which {{ item.binary }}'
|
|
changed_when: false
|
|
failed_when: python_installed.rc not in [ 0, 1 ]
|
|
register: python_installed
|
|
|
|
- name: 'check for {{ item.binary }} download'
|
|
stat:
|
|
path: '{{ python_build_dir }}/python-{{ item.version }}.tgz'
|
|
register: python_download
|
|
|
|
- block:
|
|
# TODO: verify for checksum
|
|
- name: 'retrieve python {{ item.version }} source'
|
|
become: true
|
|
get_url:
|
|
url: '{{ python_download_url }}/{{ item.version }}/Python-{{ item.version }}.tgz'
|
|
dest: '{{ python_build_dir }}/python-{{ item.version }}.tgz'
|
|
owner: '{{ ansible_user_id }}'
|
|
group: '{{ ansible_user_id }}'
|
|
when: not python_download.stat.exists
|
|
|
|
- name: 'extract python {{ item.version }} sources'
|
|
become: true
|
|
unarchive:
|
|
src: '{{ python_build_dir }}/python-{{ item.version }}.tgz'
|
|
dest: '{{ python_build_dir }}'
|
|
include: 'Python-{{ item.version }}'
|
|
|
|
- name: rename source directory
|
|
become: true
|
|
ansible.builtin.command: 'mv {{ python_build_dir}}/Python-{{ item.version }} {{ python_build_dir }}/{{ item.path }}'
|
|
|
|
- name: set correct permissions
|
|
become: true
|
|
file:
|
|
path: '{{ python_build_dir }}/{{ item.path }}'
|
|
recurse: true
|
|
owner: '{{ ansible_user_id }}'
|
|
group: '{{ ansible_user_id }}'
|
|
state: directory
|
|
|
|
- name: configure build
|
|
ansible.builtin.command: 'sh ./configure --prefix={{ python_install_dir }}/{{ item.path }}'
|
|
args:
|
|
chdir: '{{ python_build_dir }}/{{ item.path }}/'
|
|
|
|
- name: make build
|
|
ansible.builtin.command: 'make'
|
|
args:
|
|
chdir: '{{ python_build_dir }}/{{ item.path }}/'
|
|
|
|
- name: install build
|
|
become: true
|
|
ansible.builtin.command: 'make install'
|
|
args:
|
|
chdir: '{{ python_build_dir }}/{{ item.path }}/'
|
|
|
|
- name: 'create symlink for python {{ item.version }}'
|
|
become: true
|
|
file:
|
|
src: '{{ python_install_dir }}/{{ item.path }}/bin/{{ item.binary }}'
|
|
dest: '/usr/bin/{{ item.binary }}'
|
|
state: link
|
|
when: python_installed.rc not in [ 0 ]
|