Skip to content

Instantly share code, notes, and snippets.

@kojiwell
Last active December 16, 2015 20:39
Show Gist options
  • Save kojiwell/5494009 to your computer and use it in GitHub Desktop.
Save kojiwell/5494009 to your computer and use it in GitHub Desktop.
An example of fabric recipe
#!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import sys
from fabric.api import *
from fabric.contrib import *
from cuisine import *
env.use_ssh_config = True
@task
def install_pdsh():
'''Installs Parallel Distributed Shell'''
if files.exists('/opt/pdsh-2.26'):
print 'pdsh-2.26 is already installed.'
exit(1)
run('aptitude update')
select_package('apt')
package_ensure('build-essential')
if not files.exists('/root/source'):
run('mkdir /root/source')
with cd('/root/source'):
run('wget http://pdsh.googlecode.com/files/pdsh-2.26.tar.bz2')
run('tar jxvf pdsh-2.26.tar.bz2')
with cd('/root/source/pdsh-2.26'):
run('./configure --prefix=/opt/pdsh-2.26 \
--without-rsh --with-ssh \
--with-dshgroups=/opt/pdsh-2.26/dshgroups')
run('make')
run('make install')
with cd('/root'):
run('echo \'\'')
run('echo \'\'')
run('echo export PATH=/opt/pdsh-2.26/bin:\$PATH >> .bashrc')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment