Skip to content

schaffung/odinControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

odinControl

A remote command executor

Why do we need a remote command executor

Well it's an age old requirement. You have X servers and you want to configure them all without actually going over to each of those servers and doing the operation again and again.

One could leverage BASH for doing the same ? Well technically you can. Create a bash script, then leverage the use of ssh to remotely execute that BASH script across the servers. ( Actually sounds like a challenge, maybe one should take a look into it..). But then comes the question of user friendliness.

Is odinControl user friendly? You tell me. If it isn't, maybe the best way is to either open a BUG or request some new feature.

Wanna quickly try out odin?

Create a virtualenv

[user@sample odinControl]$ virtualenv v1
----some output

Activate the virtual env

[user@sample odinControl]$ source v1/bin/activate

Install the requirements for odin

[user@sample odinControl]$ pip3 instal -r requirements.txt

Set up passwordless ssh with a remote server. Currently the support is only for root user but this is to be changed to be a configurable model.

[user@sample odinControl]$ ssh-copy-id [email protected]

Edit the example to reflect the server you've just set-up for the passwordless ssh. As shown below

from odin import Odin

if __name__ == "__main__":
    server_list = ["xx.yy.zz.ll"] # The ip address change <-----
    odc = Odin(server_list)
    odc.establish_connection()
    print(odc.execute_command("echo sample_value", server_list[0]))
    print(odc.execute_command("date", server_list[0]))
    odc.deconstruct_connection()

Run the example code.

[user@sample odinControl]$ python3 example.py