mirror of https://github.com/ceph/ceph-ansible.git
Adding role for deploying python on CoreOS
parent
3e87da0f16
commit
6b014d10ed
|
@ -0,0 +1,44 @@
|
||||||
|
# Ansible role: Ceph Storage Agent
|
||||||
|
|
||||||
|
This role installs python and pip on CoreOS.
|
||||||
|
|
||||||
|
# Requirements
|
||||||
|
|
||||||
|
This role has to be run without gathering facts and with sudo attribute.
|
||||||
|
|
||||||
|
# Role variables
|
||||||
|
|
||||||
|
Have a look at: `defaults/main.yml`.
|
||||||
|
|
||||||
|
## Mandatory variables
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
New CoreOS releases support pypy in version 2.4 and above. Unfortunetly CoreOS stable channel
|
||||||
|
has to be used with pypy in version 2.4 and below due to some dependency issues.
|
||||||
|
|
||||||
|
# Example Playbook
|
||||||
|
|
||||||
|
```
|
||||||
|
- hosts: servers
|
||||||
|
remote_user: core
|
||||||
|
sudo: True
|
||||||
|
gather_facts: false
|
||||||
|
roles:
|
||||||
|
- { role: ceph-common-coreos }
|
||||||
|
```
|
||||||
|
|
||||||
|
# Contribution
|
||||||
|
|
||||||
|
**THIS REPOSITORY DOES NOT ACCEPT PULL REQUESTS**
|
||||||
|
**PULL REQUESTS MUST GO THROUGH [CEPH-ANSIBLE](https://github.com/ceph/ceph-ansible)**
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
Apache
|
||||||
|
|
||||||
|
# Author Information
|
||||||
|
|
||||||
|
This role was created by Alfredo Deza.
|
|
@ -0,0 +1,7 @@
|
||||||
|
coreos_pypy_version: 4.0.1
|
||||||
|
coreos_pypy_arch: linux64
|
||||||
|
coreos_pypy_url: https://bitbucket.org/pypy/pypy/downloads/pypy-{{coreos_pypy_version}}-{{coreos_pypy_arch}}.tar.bz2
|
||||||
|
pypy_directory: /opt/pypy
|
||||||
|
pypy_binary_directory: /opt/bin
|
||||||
|
pip_url: https://bootstrap.pypa.io/get-pip.py
|
||||||
|
local_temp_directory: /tmp
|
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
- name: download get_pip.py
|
||||||
|
raw: cd $HOME && wget {{pip_url}}
|
||||||
|
|
||||||
|
- name: run get-pip.py
|
||||||
|
raw: "{{pypy_binary_directory}}/python $HOME/get-pip.py"
|
||||||
|
|
||||||
|
- name: create local temp directory
|
||||||
|
local_action: raw mkdir -p {{local_temp_directory}}
|
||||||
|
sudo: no
|
||||||
|
|
||||||
|
- name: prepare install_pip.sh
|
||||||
|
local_action: template src=install_pip.sh.j2 dest={{local_temp_directory}}/install_pip.sh
|
||||||
|
sudo: no
|
||||||
|
|
||||||
|
- name: run pip.sh
|
||||||
|
script: "{{local_temp_directory}}/install_pip.sh"
|
||||||
|
|
||||||
|
- name: add execute permission
|
||||||
|
raw: chmod a+x {{pypy_directory}}/pip
|
||||||
|
|
||||||
|
- name: move python to binary directory
|
||||||
|
raw: mv {{pypy_directory}}/pip {{pypy_binary_directory}}/pip
|
||||||
|
|
||||||
|
- name: create .pip
|
||||||
|
raw: touch $HOME/.pip
|
||||||
|
|
||||||
|
- name: remove pip.sh
|
||||||
|
local_action: file path="{{local_temp_directory}}/pip.sh" state=absent
|
||||||
|
sudo: no
|
|
@ -0,0 +1,33 @@
|
||||||
|
---
|
||||||
|
- name: download python
|
||||||
|
raw: cd $HOME && wget -O - {{coreos_pypy_url}} |tar -xjf -
|
||||||
|
|
||||||
|
- name: move pypy to pypy_install_directory
|
||||||
|
raw: mv $HOME/pypy-{{coreos_pypy_version}}-{{coreos_pypy_arch}} {{pypy_directory}}
|
||||||
|
|
||||||
|
- name: create local temp directory
|
||||||
|
local_action: raw mkdir -p {{local_temp_directory}}
|
||||||
|
sudo: no
|
||||||
|
|
||||||
|
- name: prepare python executable
|
||||||
|
local_action: template src=install_python.sh.j2 dest={{local_temp_directory}}/install_python.sh
|
||||||
|
sudo: no
|
||||||
|
|
||||||
|
- name: fix library
|
||||||
|
raw: ln -s /lib64/libncurses.so.5.9 {{pypy_directory}}/lib_pypy/libtinfo.so.5
|
||||||
|
|
||||||
|
- name: run install_python.sh
|
||||||
|
script: "{{local_temp_directory}}/install_python.sh"
|
||||||
|
|
||||||
|
- name: add execute permission
|
||||||
|
raw: chmod a+x {{pypy_directory}}/python
|
||||||
|
|
||||||
|
- name: move python to binary directory
|
||||||
|
raw: mv {{pypy_directory}}/python {{pypy_binary_directory}}/python
|
||||||
|
|
||||||
|
- name: create .python
|
||||||
|
raw: touch $HOME/.python
|
||||||
|
|
||||||
|
- name: remove install_python.sh
|
||||||
|
local_action: file path="{{local_temp_directory}}/install_python.sh" state=absent
|
||||||
|
sudo: no
|
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
- name: check if there is python
|
||||||
|
raw: stat $HOME/.python
|
||||||
|
register: need_python
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- include: install_pypy.yml
|
||||||
|
when: need_python | failed
|
||||||
|
|
||||||
|
- name: check if there is pip
|
||||||
|
raw: stat $HOME/.pip
|
||||||
|
register: need_pip
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- include: install_pip.yml
|
||||||
|
when: need_pip | failed and need_python | failed
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
cat > {{pypy_directory}}/pip << EOF
|
||||||
|
#!/bin/bash
|
||||||
|
LD_LIBRARY_PATH={{pypy_directory}}/lib_pypy:$LD_LIBRARY_PATH exec {{pypy_directory}}/bin/pip "\$@"\
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cat > {{pypy_directory}}/python << EOF
|
||||||
|
#!/bin/bash
|
||||||
|
LD_LIBRARY_PATH={{pypy_directory}}/lib_pypy:$LD_LIBRARY_PATH exec {{pypy_directory}}/bin/pypy "\$@"\
|
Loading…
Reference in New Issue