Skip to content

Instantly share code, notes, and snippets.

@theofilis
Created August 12, 2014 09:12
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 theofilis/38b522846782c3e69de9 to your computer and use it in GitHub Desktop.
Save theofilis/38b522846782c3e69de9 to your computer and use it in GitHub Desktop.
simple client to handle varius task on mongdb
from fabric.api import *
env.user = 'root'
env.hosts = ['host']
@parallel
def install():
run('apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10')
run("echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list")
with hide('output'):
run('apt-get update')
run('apt-get install mongodb-org -y')
run('service mongod stop')
def start():
run('service mongod start')
def stop():
run('service mongod stop')
def status():
run('service mongod status')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment