Skip to content

Instantly share code, notes, and snippets.

@yubessy
Last active September 12, 2017 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yubessy/92fb91ca3691905fa3e7aa98b4bf745f to your computer and use it in GitHub Desktop.
Save yubessy/92fb91ca3691905fa3e7aa98b4bf745f to your computer and use it in GitHub Desktop.
Ansible Python Role
---
python_version: 3.6.2
---
- name: python deps are installed
yum:
name: '{{ item }}'
state: present
with_items:
- zlib-devel
- bzip2
- bzip2-devel
- readline-devel
- sqlite
- sqlite-devel
- openssl-devel
- name: python is downloaded
get_url:
url: https://www.python.org/ftp/python/{{ python_version }}/Python-{{ python_version }}.tgz
dest: /tmp/Python-{{ python_version }}.tgz
- name: python is extracted
command: tar -xfz /tmp/Python-{{ python_version }}.tgz
creates: /tmp/Python-{{ python_version }}
set_fact:
tmp_python_dir: /tmp/Python-{{ python_version }}
- name: build is configured
command: ./configure
creates: {{ tmp_python_dir }}/Makefile
chdir: {{ tmp_python_dir }}
- name: python is built
command: make
creates: {{ tmp_python_dir }}/bin/python
chdir: {{ tmp_python_dir }}
- name: python is installed
command: make install
chdir: {{ tmp_python_dir }}
creates: /usr/local/bin/python{{ python_version }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment