Execute.py 773 Bytes
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
import GanetiCluster, paramiko, os


class JustSendFiles(object):
def __init__(self):
eucacluster = GanetiCluster.GanetiCluster('Coordinator.properties')
instances = eucacluster.describe_instances()
for instance in instances:
print str(instance.ip_address)
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(instance.ip_address, username='root', password='secretpw')
if instance.ip_address == "192.168.1.80":
print "master"
#stdin, stdout, stderr = ssh.exec_command('/bin/sh ~/gstar/bandwidth_limit.sh')
else:
stdin, stdout, stderr = ssh.exec_command('sudo apt-get -y remove --purge apache2 ganglia-*')
ssh.close()
if __name__ == "__main__":
sendthem = JustSendFiles()