Now that I discovered ansible, this repo shall carry only historical value and not be used in any way
https://docs.ansible.com/ansible/latest/modules/routeros_command_module.html
- fairly modern bash
- ftp enabled on devices (one time requirement to deploy keys, later on only ssh will be used)
- ssh-server enabled
- modern RouterOS/SwitchOS
Set executable bit on mikrotik-crtl.sh with chmod +x mikrotik-crtl.sh
and run it with sh mikrotik-crtl.sh
or ./mikrotik-crtl.sh
Script will ask you for login credentials and IP address of device you wish to manage and deploy RSA keys
You can specify IP address or populate ip.txt file with ip addresses that will be used
On devices - sepatate user will be created, this user will be named as login you specified while running script with addition of _ssh
to user name
Later you can use ssh passwordless login using your ~/.ssh/id_rsa key with this user name. ex: admin
_ssh@10.10.10.10
payload.txt contains list of commands that will be executed on selected host or group of hosts from ip.txt
You can populate ip.txt file in directory where script is placed with IP addresses of devices that will receive keys and commands to execute from payload.txt file.
This file contains IP's of devices that scritps had previously deployed keys to, this devices is ignored wher key-check phase is run
Simple SNMP configuration provisioning
File ip.txt is populated with:
10.1.2.100
10.1.2.101
10.1.2.102
10.1.2.103
File payload.txt contains:
/snmp community set [ find default=yes ] addresses=10.1.2.2/32
/snmp set contact=geexmmo enabled=yes location=branch-server-room trap-version=2
Result: Mikrotik devices will now accept SNMP collector from my Zabbix instance on 10.1.2.2