1

I currently have my own set of wrappers around Paramiko, a few functions that log the output as a command gets executed, reboot some server, transfer files, etc. However, I feel like I'm reinventing the wheel and this should already exist somewhere.

I've looked into Fabric and it partially provides this, but its execution model would force me to rewrite a big part of my code, especially because it shares information about the hosts in a global variables and doesn't seem to be originally intended to be used as a library.

Preferably, each server should be represented by an object, so I could save state about it and run commands using something like server.run("uname -a"), provide some basic tools like rebooting, checking for connectivity, transferring files and ideally even give me some simple way to run a command on a subset of servers in parallel.

Is there already some library that provides this?

mkollaro
  • 11
  • 1

2 Answers2

0

Look at Ansible: 'minimal ssh command and control'. From their description: 'Ansible is a radically simple configuration-management, deployment, task-execution, and multinode orchestration framework'.

mguijarr
  • 7,641
  • 6
  • 45
  • 72
  • I've looked at it and didn't see a single example on how to use it as a library and not from the command line. Any links? – mkollaro Oct 10 '13 at 10:11
  • Just did a small search on Google: http://jpmens.net/2012/12/13/obtaining-remote-data-with-ansible-s-api/ ; seems the main thing to get access to the API is to use `ansible.runner` module – mguijarr Oct 10 '13 at 11:25
0

Fabric 2.0 (currently in development) will probably be similar to what you have in mind.

Have a look at https://github.com/fabric/fabric/tree/v2

ronnix
  • 1,514
  • 1
  • 11
  • 9
  • From the README file, it seems like this is exactly what I want. But looking at that branch, I don't really see anything implemented :( – mkollaro Oct 10 '13 at 10:12