I have the following fabfile.py:
from fabric.api import env, run
host1 = '192.168.200.181'
host2 = '192.168.200.182'
host3 = '192.168.200.183'
env.hosts = [host1, host2, host3]
def df_h():
run("df -h | grep sda3")
And I get the following output:
[192.168.200.181] run: df -h | grep sda3
[192.168.200.181] out: /dev/sda3 365G 180G 185G 50% /usr/local/nwe
[192.168.200.183] run: df -h | grep sda3
[192.168.200.183] out: /dev/sda3 365G 41G 324G 12% /usr/local/nwe
[192.168.200.182] run: df -h | grep sda3
[192.168.200.182] out: /dev/sda3 365G 87G 279G 24% /usr/local/nwe
Done.
Disconnecting from 192.168.200.182... done.
Disconnecting from 192.168.200.181... done.
Disconnecting from 192.168.200.183... done.
Note that the execution order is different from the env.hosts specification.
Why does it work this way? Is there a way to make the execution order the same as specified in env.hosts list?