Created
October 16, 2015 14:48
-
-
Save skyler/036f5de9f7a8f8f8d4aa to your computer and use it in GitHub Desktop.
Python tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: yum packages for building python | |
yum: name={{ item }} state=latest | |
with_items: | |
- zlib-devel | |
- bzip2-devel | |
- openssl-devel | |
- xz-libs | |
- name: create work directories | |
file: path={{ item }} state=directory | |
with_items: | |
- "{{ python_build_dir }}" | |
- "{{ python_build_dir }}/src" | |
- "{{ python_build_dir }}/setuptools" | |
- name: download python source | |
get_url: | |
url={{ python_download_url }} | |
dest="{{ python_build_dir }}/python.tgz" | |
- name: extract python source | |
command: /bin/tar -xf {{ python_build_dir }}/python.tgz -C {{ python_build_dir }}/src --strip-components=1 | |
- name: build python | |
command: "{{ item }}" | |
with_items: | |
- ./configure --prefix=/usr/local | |
- /usr/bin/make | |
- /usr/bin/make altinstall | |
args: | |
creates: "{{ python27_bin }}" | |
chdir: "{{ python_build_dir }}/src" | |
- name: download setuptools | |
get_url: | |
url={{ setuptools_download_url }} | |
dest="{{ python_build_dir }}/setuptools.tgz" | |
- name: extract setuptools source | |
command: /bin/tar -xf {{ python_build_dir }}/setuptools.tgz -C {{ python_build_dir }}/setuptools --strip-components=1 | |
- name: install setuptools | |
command: "{{ python27_bin }} setup.py install" | |
args: | |
chdir: "{{ python_build_dir }}/setuptools" | |
- name: download pip | |
get_url: | |
url={{ pip_download_url }} | |
dest="{{ python_build_dir }}/get-pip.py" | |
- name: install pip | |
command: "{{ python27_bin }} {{ python_build_dir }}/get-pip.py" | |
- stat: path=/usr/local/bin/npm | |
register: npm_stat | |
- name: tell npm to use this version of python | |
command: /usr/local/bin/npm config set python python2.7 | |
when: npm_stat.stat.exists == True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment