Skip to content

Instantly share code, notes, and snippets.

@davidthewatson
Created June 29, 2011 21:32
Show Gist options
  • Save davidthewatson/1055040 to your computer and use it in GitHub Desktop.
Save davidthewatson/1055040 to your computer and use it in GitHub Desktop.
This is a copy of my current fabric configuration
from fabric.api import env, put, run, sudo
from fabric.contrib.files import upload_template
env.hosts = ['host1', 'host2']
env.password = 'your_password'
def upgrade():
run('apt-get update && apt-get -y upgrade')
reboot()
def reboot():
run('reboot')
def poweroff():
run('poweroff')
def hostname():
run('hostname')
def install_avahi():
run('apt-get -y install avahi-daemon')
def install_mdns():
run('apt-get -y install libnss-mdns')
def install_monit():
put('./monit-5.2.5-linux-x86.tar', '/tmp/monit-5.2.5-linux-x86.tar')
run('tar xvf /tmp/monit-5.2.5-linux-x86.tar')
hostname = run('hostname')
print 'hostname', hostname
upload_template('./monitrc', '/etc/monitrc', context={'hostname': hostname})
run('chmod 0700 /etc/monitrc')
run('./monit-5.2.5/bin/monit -d 5')
def install_everything():
install_avahi()
install_mdns()
install_monit()
def change_hostname(hostname):
upload_template('./hostname', '/etc/hostname', context={'hostname': hostname})
reboot()
%(hostname)s
set mmonit http://monit:monit@yourhost:8080/collector
set httpd port 2812 and use address %(hostname)s
allow localhost
allow mmonit_server_hostname
allow monit:monit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment