fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] How to install softwares parallel


From: Morgan Goose
Subject: Re: [Fab-user] How to install softwares parallel
Date: Fri, 13 Jul 2012 06:35:01 -0700

Use ssh keys to keep from having passwords. If the usernames change
per host/ip you can do some python stuff to help out, but if it's the
same all over, say root or installer, that's simple.

defining a range is simpler too if you use a list comprehension:

env.hosts = ['192.168.0.%d" % x for x in range(255)]

@task
def foo(): pass

or

@task
@hosts(['192.168.0.%d" % x for x in range(255)])
def foo: pass


On the sudo issue, passwordless sudo is key. You can have someone
install an sudoers.d file (or edit /etc/sudoers) to allow the one user
to run the specific command that way. Lots of docs online about that.
But Jorge nailed most of that in his response.

If you can get the keys and the sudo privileges you can then also use
@parallel, which would speed things up for you.

On Jorge's pexpect suggestion, there is a project that does do some
pexpect magic that might be useful:
http://ilogue.com/jasper/blog/improved-fexpect-now-on-pypi/

Though hardcoding in passwords plaintext isn't suggested.

-goose




On Thu, Jul 12, 2012 at 1:06 PM, Jorge Vargas <address@hidden> wrote:
> Hi,
>
> On Thu, Jul 12, 2012 at 3:10 PM, Dpin Thomas <address@hidden>
> 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
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/fab-user
>>
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fab-user
>



reply via email to

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