Fabric is more suitable for running shell commands remotely - think about
the commands in your fabfile as abstractions on top of what a shell
offers. If you are thinking that you need to install fabric on each
machine, you should consider rethinking your approach as it might be easier
than you realize.
Your fabfile issues instructions via run/sudo/cd/et al and the 'fab'
command runs those instructions on N remote computers for you. You don't
run the fabfile on each computer - the fabfile is designed to connect, via
ssh, to the other computers and run the shell commands that are beneath the
python abstractions.
If you absolutely had to run a python script remotely, and that script was
not installed on those servers, you could use fabric to install the script
on the remote system and then execute it. This requires that your servers
have python, pip/setuptools, and any system-level dependencies that are
needed. Those servers do not need fabric to be installed.
Method 1: Store the python package in a central location (github or
something) and, in your fabfile, issue commands to download and install
that package and it's dependencies, and then execute the script.
'run("wget something"); run("pip install -e ./something")'.
Method 2: Use fabric to copy the python package to the remote servers, and
do the same as above
Method 3: Store a pre-'compiled' virtualenv with your script, and use the
copy command to push the whole thing to the servers. This will require
your virtualenv be built for the target architecture of the remote
servers. I mention but don't recommend it, unless your whole fleet is
identical.
Post by bohdan kalytovskyyNeed to run python script with fabric on multiple computers with out
installing fabric on all of them, how can I achieve that?
Thank you.
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user