An open API service indexing awesome lists of open source software.

https://github.com/krsmanovic/mikrotik-distributed-ssh

Python script that connects to MikroTik routers via ssh and executes list of commands. Both inventory and command lists are loaded from external files. Create separate log entries for successful connections and errors.
https://github.com/krsmanovic/mikrotik-distributed-ssh

inventory mikrotik mikrotik-routers python ssh ssh-keys

Last synced: about 1 month ago
JSON representation

Python script that connects to MikroTik routers via ssh and executes list of commands. Both inventory and command lists are loaded from external files. Create separate log entries for successful connections and errors.

Awesome Lists containing this project

README

        

# MikroTik SSH script based on Python "paramiko" module

This is a tool for executing many MikroTik commands from external `commands` file to many MikroTik routers listed in `hosts` file. Using ssh keys method is strongly advised! Remember to remove all credentials left in clear text if you opt in for that type of connection!

Log files `error.log` or `success.log` are appended depending on the result of the script execution.

## 1) Setup the inventory and commands

Populate the files `hosts` (inventory) and `commands` according to your task. Sample files are provided in `/scripts` folder together with the source code.

## 2) Enter the credentials within the script

Edit the `mt_username` and `ssh_key` variables according to your environment.

It is strongly advised never to keep credentials in clear text and use ssh keys whenever possible! If you opted in for using clear text passowrd with `mt_password` variable, remember to remove it after you are finished with your work!

## 3) Run the script

Start the script with
```
python mikrotik-ssh.py
```