Community discussions

MikroTik App
 
olivier2831
Member Candidate
Member Candidate
Topic Author
Posts: 296
Joined: Fri Sep 08, 2017 6:53 pm

Advice on configuring Mikrotik devices with Ansible

Fri Oct 13, 2023 10:05 am

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
 
olivier2831
Member Candidate
Member Candidate
Topic Author
Posts: 296
Joined: Fri Sep 08, 2017 6:53 pm

Re: Advice on configuring Mikrotik devices with Ansible

Fri Oct 13, 2023 10:11 am

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.
 
User avatar
irrwitzer
just joined
Posts: 23
Joined: Mon Apr 11, 2022 11:54 pm

Re: Advice on configuring Mikrotik devices with Ansible

Fri Oct 13, 2023 1:07 pm

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 ... 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-n ... -routeros/
https://docs.ansible.com/ansible/latest ... guide.html
 
User avatar
memelchenkov
Member Candidate
Member Candidate
Posts: 202
Joined: Sun Oct 11, 2020 12:00 pm
Contact:

Re: Advice on configuring Mikrotik devices with Ansible

Fri Oct 13, 2023 2:20 pm

Check TR069 instead, will it work for you or not.
 
olivier2831
Member Candidate
Member Candidate
Topic Author
Posts: 296
Joined: Fri Sep 08, 2017 6:53 pm

Re: Advice on configuring Mikrotik devices with Ansible

Fri Oct 13, 2023 2:23 pm

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) ?

Who is online

Users browsing this forum: No registered users and 10 guests