fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] fab version


From: Kaushal Shriyan
Subject: Re: [Fab-user] fab version
Date: Tue, 25 Oct 2011 00:28:06 +0530

On Mon, Oct 24, 2011 at 6:56 PM, Ronan Amicel <address@hidden> wrote:
> On Mon, Oct 24, 2011 at 07:59, Kaushal Shriyan <address@hidden> wrote:
>> Am i missing anything
>
> If you want to capture the output of the "route -n" command on the
> remote host, you should probably just use (without ".stderr"):
>
>     checkroute = run("route -n")
> Hope this helps,
>
> --
> Ronan Amicel
>

Hi,

Thanks Ronan. is there a way to format the output in a more
presentable format. The below output is not in a readable format. Can
you please point me to the relevant docs.

address@hidden:~$ cat output.txt
10.0.0.101: Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.30.0.0       10.0.0.238      255.255.255.0   UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 eth0
10.40.0.0       10.0.0.119      255.255.0.0     UG    0      0        0 eth0
0.0.0.0         10.0.0.10       0.0.0.0         UG    0      0
0 eth010.0.0.102: Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 eth0
10.30.0.0       10.0.0.238      255.255.0.0     UG    0      0        0 eth0
0.0.0.0         10.0.0.10       0.0.0.0         UG    0      0
0 eth010.0.0.103: Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 eth0
10.30.0.0       10.0.0.238      255.255.0.0     UG    0      0        0 eth0
0.0.0.0         10.0.0.10       0.0.0.0         UG    0      0
0 address@hidden:~$
address@hidden:~$
address@hidden:~$ cat fabfile.py
#!/usr/bin/env python
from fabric.api import *
env.shell = '/bin/bash -l -c'
out_log = open("output.txt", "w")
with open("hosts.txt") as host_file:
        host_list = [x.strip() for x in host_file.readlines()]

@hosts(host_list)
def route():
        with settings(warn_only=True):
            checkroute = run("route -n")
        out_log.write("%s: %s" % (env.host, checkroute))
address@hidden:~$

Also How do i have different fabric files, For example the one above
does "fab route" and lets say if i have to have different activity,
for example version of ssh package on all 100 servers, so do i need to
have fabric files as fabfile1.py or somefile.py and invoke it via
using fab -f fabfile1.py or fab -f somefile.py

Please suggest.

Regards,

Kaushal



reply via email to

[Prev in Thread] Current Thread [Next in Thread]