Hi,

On Thu, Jul 12, 2012 at 3:10 PM, Dpin Thomas <[email protected]>wrote:

>  Hi All, ****
>
> ** **
>
>    I Have been trying  from many  days to install software in my college
> lab , where i have 52 system.  All the user name and password are same, so
> i need to make multiple copies in env.hosts and env.passwords<<any solution
> for this ?>>. ****
>
> **
>

Yes, you can declare them inside the task rather than outside and fabric
will not connect until it's find a run or sudo command.

So you can do some sort of loop in your command ie:

hosts = (domain,user,password)

@task
def install():
    for host in hosts:
         env.host_string = host[0]
         run(....)

http://docs.fabfile.org/en/1.4.2/usage/env.html#host-string is the actual
variable to execute the connects.

 **
>
>  1) And how declare ip range in env.hosts?
>

With regular python. ie:
hosts = []
for i in range(5,100):
    hosts.append("6.6.6.%d" % i)


> ****
>
> 2)Can any one tell me how  to run fabric script to install software , as i
> am not able to run sudo su on my client systems parallel ,  i will  be
> prompted to re-enter the password.
>

This is a problem. fabric is designed to work based on ssh keys, which
means asking for the password is something that will give you problems.
Ideally you will have to configure your account to have passwordless sudo.
If that is not some command allow you to specify the password in the CLI or
you can pipe it in (both are insecure as people using ps can see your
password) but it's possible here are full explanations of each of those
options
http://stackoverflow.com/questions/3737003/can-i-prevent-fabric-from-prompting-me-for-a-sudo-password

Alternatively you could look into which will allow you to parse the
input/output of the command with a tool specific to that like
http://www.noah.org/wiki/pexpect

>  **
>
>    Thank you
>

Hope that helps.

>  ****
>
> ** **
>
> Regards****
>
> Dipin Thomas****
>
> _______________________________________________
> 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

Reply via email to