Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Import Fabric's API module
- from fabric.api import *
- hosts = [ {"host":"192.168.0.101", "password":"password", "user":"pi"},
- {"host":"192.168.0.13", "password":"password", "user":"pi"},
- {"host":"192.168.0.103", "password":"password", "user":"pi"},
- {"host":"192.168.0.12", "password":"password", "user":"pi"},
- {"host":"192.168.0.10", "password":"password", "user":"pi"},
- ]
- local_file = "/home/pi/scripts/cpu_mqtt.py"
- remote_file = "/home/pi/scripts/cpu_mqtt.py"
- if __name__ == '__main__':
- for host in hosts:
- try:
- # Set the username
- env.user = host['user']
- env.host_string = host['host']
- # Set the password [NOT RECOMMENDED]
- env.password = host['password']
- env.disable_known_hosts = True
- with hide('everything'):
- put(local_file, remote_file)
- print(env.host_string+" - Done")
- except KeyboardInterrupt:
- print("\n"+env.host_string+" - Failed")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement