Have you read any of the docs online yet or at least the tutorial? A lot of your questions would be answered by the documentation that was written specifically to adress the common use cases.
- goose On Mon, Oct 24, 2011 at 11:58 AM, Kaushal Shriyan <[email protected]> wrote: > On Mon, Oct 24, 2011 at 6:56 PM, Ronan Amicel <[email protected]> wrote: >> On Mon, Oct 24, 2011 at 07:59, Kaushal Shriyan <[email protected]> >> 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. > > kaushal@kaushal-laptop:~$ 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 eth0kaushal@kaushal-laptop:~$ > kaushal@kaushal-laptop:~$ > kaushal@kaushal-laptop:~$ 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)) > kaushal@kaushal-laptop:~$ > > 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 > > _______________________________________________ > Fab-user mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/fab-user > _______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
