How Do You Automate Tasks in MikroTik?

Hello everyone,

I’m curious—how do you handle automation in MikroTik?

For example, I often work with wireless antennas that have many stations connected. When I need to find the best frequency, I currently do it manually—going through each device, pasting the same command, and if I need to make changes, I have to repeat the whole process again.

This got me thinking—there must be a better way! I’m brainstorming automation ideas because I know I’ll have to do this repeatedly in the future.

How do you automate similar tasks? Any scripts, tools, or methods you use? I’d love to hear your insights!

Scheduler and Scripting:

https://help.mikrotik.com/docs/spaces/ROS/pages/40992881/Scheduler
https://help.mikrotik.com/docs/spaces/ROS/pages/47579229/Scripting

ansible

I just created an Ansible playbook to set up an RB960 as a NAT gateway to my ISP. It is 99% idempotent. The Ansible community.routeros.api is pretty good now. Haven't tested this yet, as I'm still awaiting the fibre install.

I still have minor problems with several calls reporting that they had changed the config, but the config is unchanged. I also have one firewall rule that reports a change, and that results in duplicate rules every time the playbook is run.

The settings are in vars/interfaces.yml
The firewall and nat rules are in vars/firewall.yml
A few basic settings are in the inventory file (see the inventory_template)
Nb. variables in these files have - replaced by _ to make Ansible happy