Advice on configuring Mikrotik devices with Ansible

Hello,

I’m quite used now to manage Debian hosts with Ansible.
I would like to also manage Mikrotik RouterOS device with Ansible.

The whole picture is:

  • using Flashfig to initialize the platform (management IP, firmware, certs, creds, management accounts, enabling/disabling protocols, …)
  • using Ansible to set IP addresses and VLAN, firwalling

Which Ansible module shall I favor first (and why) as some seem to use SSH while some use RouterOS API ?
Are you aware of Mikrotik directly contributing to these modules ?

Best regards

When using CLI to configure RouterOS, I had trouble to script idempotent operations such as “create VLAN 10 if it doesn’t exist”.
I don’t mean it’s not possible to write idempotent scripts with CLI, I only mean I had trouble doing so.

One expected benefit from using Ansible is to ease idempotent configuration.

Hi Olivier,

I dind’t find a perfect ansible module for this, when I was searching in early 2022. Maybe things have changed, but I’m currently using
https://docs.ansible.com/ansible/latest/collections/community/routeros/index.html

---
collections:
  - community.routeros

For basic stuff. It’s not really indempotent though.

Other links in my notes:

https://yetiops.net/posts/ansible-for-networking-part-6-mikrotik-routeros/
https://docs.ansible.com/ansible/latest/collections/community/routeros/docsite/ssh-guide.html

Check TR069 instead, will it work for you or not.

Does TR069 support VLAN configuration (ie not just for WAN port but for bridge or interface) ?