3 ms·
For those wondering, "What simple tools take a list of server credentials and run the same command on all of them?", Fabric is a great one: http://www.fabfile.o
by bshimmin 12y ago
For those wondering, "What simple tools take a list of server credentials and run the same command on all of them?", Fabric is a great one: http://www.fabfile.org/en/latest/ http://www.fabfile.org/en/latest/
- knave 12y agoThanks for the specifics!
- sandstrom 12y agoFabric is a great suggestion! Here is a small fabfile as an example. It's super-simple (wrote it for this answer), but should be less than 5 min if anyone need something quick. from fabric.api import * # Fabric # # Simple tool to execute commands on multiple machines. # Use for easier, ad-hoc changes, such as package updates. # # http://docs.fabfile.org # # Installation on OS X # `brew update && brew install python && pip install fabric` # use local ssh config env.use_ssh_config = True # Hard-coding host IPs is not ideal! There are better ways: # http://docs.fabfile.org/en/latest/usage/execution.html#defining-host-lists all_nodes = [ '10.10.10.1', '10.10.10.2', ] # print uptime # usage: `fab uptime` @hosts(all_nodes) def uptime(): run('uptime') # install package via apt # usage: `fab install_package:my-package-name` @hosts(all_nodes) def install_package(package): run('sudo apt-get update && sudo apt-get install {name}'.format(name=package)) # check package version # usage: `fab package_version:my-package-name` @hosts(all_nodes) def package_version(package): run('dpkg -s {name} | grep Version'.format(name=package))