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.
- Host: GitHub
- URL: https://github.com/krsmanovic/mikrotik-distributed-ssh
- Owner: krsmanovic
- License: mit
- Created: 2017-08-15T11:44:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-12T20:34:07.000Z (about 4 years ago)
- Last Synced: 2024-02-14T21:24:58.857Z (about 1 year ago)
- Topics: inventory, mikrotik, mikrotik-routers, python, ssh, ssh-keys
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 23
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```