Skip to content

Instantly share code, notes, and snippets.

@happysundar
Created August 7, 2014 22:31
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 happysundar/8c663f57d49eb89d01d2 to your computer and use it in GitHub Desktop.
Save happysundar/8c663f57d49eb89d01d2 to your computer and use it in GitHub Desktop.
playbook to get virtualenv + pythoz installed in a Centos box
---
- hosts: all
sudo: yes
tasks:
- name: install the EPEL and remi repos
yum: name={{item}}
state=installed
with_items:
- http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
- http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
- name: install vim
yum : name=vim-common state=present
- name: epel repository enable
ini_file: dest=/etc/yum.repos.d/epel.repo
section=epel
option=enabled
value=1
- name: remi repository enable
ini_file: dest=/etc/yum.repos.d/remi.repo
section=remi
option=enabled
value=1
- name: install pythonz
shell: curl -kL https://raw.github.com/saghul/pythonz/master/pythonz-install | bash
- name: modifying write permissions for the directory /usr/local/pythonz
command: chmod a+w -R /usr/local/pythonz
- name: install python-2.7.8
command: /usr/local/pythonz/bin/pythonz install 2.7.8
remote_user: vagrant
sudo: no
- name: adding pythonz to user's .bashrc..
lineinfile: dest=~/.bashrc.user line="[[ -s /usr/local/pythonz/etc/bashrc ]] && source /usr/local/pythonz/etc/bashrc" backup=yes
sudo: no
- name: adding pythonz to user's $PATH...
lineinfile: dest=~/.bashrc.user line="[[ -d /usr/local/pythonz/pythons/CPython-2.7.8/bin ]] && export PATH=$PATH:/usr/local/pythonz/pythons/CPython-2.7.8/bin" backup=yes
sudo: no
- name: find if virtualenv-burrito is already installed
stat: path=~/.venvburrito
register: venvburrito_exists
- debug: msg="Path exists and is a directory"
when: venvburrito_exists.stat.isdir is defined and venvburrito_exists.stat.isdir == true
- name : installing virtualenv-burrito...
shell : curl -sL https://raw.githubusercontent.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | /bin/bash
when: venvburrito_exists.stat.isdir is defined and venvburrito_exists.stat.isdir == true | success
sudo: no
- name : adding virtualenvburrito startup.sh to user's bashrc...
lineinfile: dest=~/.bashrc.user line="[[ -s ~/.venvburrito/startup.sh ]] && source ~/.venvburrito/startup.sh" backup=yes
sudo: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment