Compilation of scripts for Mikrotik routers/switches.
certs-creator
: create IKEv2 certscerts-updater
: renew IKEv2 certsemail-sender
: send an e-mail every 1st day of the monthEoIP-logging
: log information on changes in the EoIP tunnelEoIP-onoff-layer2
: turn on/off EoIP tunnel with a layer 2 pingEoIP-onoff-layer3
: turn on/off EoIP tunnel with a layer 3 pingfirewall-mac
: create firewall rules with an IP address taken from the DHCP serverIPSec-reset
: reset the EoIP tunnel if it does not respondlogging-internet
: if another Mikrotik stops responding ping, save the date to a filelogging-power
: save power state in filelogging-report
: save connection quality in fileusb-4g-reset
: if the EoIP tunnel is not active, it will restart it
On the terminal of the device:
/system scheduler
add comment="Ejecuta SCRIPT X" interval=1m name=schedulerName on-event=scriptName policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup
vi devices.txt
[MikrotikDevices]
device1 ansible_ssh_host=192.168.XXX.XXX ansible_network_os=routeros
device2 ansible_ssh_host=192.168.XXX.XXX ansible_network_os=routeros
vi MikrotikTask1.yml
---
- name: "Script for Mikrotik"
hosts: Mikrotik_devices
connection: network_cli
gather_facts: no
tasks:
- name: script1
routeros_command:
commands: ***COMMAND 1 ; COMMAND 2 ; COMMAND 3 ...***
...
ansible-playbook MikrotikTask1.yml -i devices.txt -u USER -k