Skip to content

Instantly share code, notes, and snippets.

@binarymatt
Created March 9, 2011 21:29
Show Gist options
  • Save binarymatt/863046 to your computer and use it in GitHub Desktop.
Save binarymatt/863046 to your computer and use it in GitHub Desktop.
from fabric.api import local,run, sudo, cd, prefix, env, put, settings, show
env.hosts = ['33.33.33.10']
env.user = 'vagrant'
def first():
run('ifconfig eth1')
def second():
with settings(
hosts=['33.33.33.11'],
):
first()
$ fab first
[33.33.33.10] Executing task 'first'
[33.33.33.10] run: ifconfig eth1
[33.33.33.10] out: eth1 Link encap:Ethernet HWaddr 08:00:27:27:d1:42
[33.33.33.10] out: inet addr:33.33.33.10 Bcast:33.33.33.255 Mask:255.255.255.0
[33.33.33.10] out: inet6 addr: fe80::a00:27ff:fe27:d142/64 Scope:Link
[33.33.33.10] out: UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[33.33.33.10] out: RX packets:361 errors:0 dropped:0 overruns:0 frame:0
[33.33.33.10] out: TX packets:269 errors:0 dropped:0 overruns:0 carrier:0
[33.33.33.10] out: collisions:0 txqueuelen:1000
[33.33.33.10] out: RX bytes:49073 (49.0 KB) TX bytes:48601 (48.6 KB)
[33.33.33.10] out:
[33.33.33.10] out:
Done.
Disconnecting from 33.33.33.10... done.
(testfabric)mattgeorge@mattgeorge in ~/testfab
$ fab second
[33.33.33.10] Executing task 'second'
[33.33.33.10] run: ifconfig eth1
[33.33.33.10] out: eth1 Link encap:Ethernet HWaddr 08:00:27:27:d1:42
[33.33.33.10] out: inet addr:33.33.33.10 Bcast:33.33.33.255 Mask:255.255.255.0
[33.33.33.10] out: inet6 addr: fe80::a00:27ff:fe27:d142/64 Scope:Link
[33.33.33.10] out: UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[33.33.33.10] out: RX packets:389 errors:0 dropped:0 overruns:0 frame:0
[33.33.33.10] out: TX packets:291 errors:0 dropped:0 overruns:0 carrier:0
[33.33.33.10] out: collisions:0 txqueuelen:1000
[33.33.33.10] out: RX bytes:52727 (52.7 KB) TX bytes:52540 (52.5 KB)
[33.33.33.10] out:
[33.33.33.10] out:
Done.
Disconnecting from 33.33.33.10... done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment