Enabling MikroTik REST API Over SSL Using Ansible
In this guide, we’ll show you how to enable the MikroTik REST API over SSL using Ansible 1. Starting from RouterOS v7.9, MikroTik officially supports SSL for the REST API 2.
We’ll break down the process into six simple steps:
- Set up a Python environment and install Ansible
- Test Ansible connectivity to the MikroTik router
- Generate a self-signed SSL certificate
- Enable the REST API with SSL
- Test the REST API with
curl
- Automate SSL certificate renewal with a script
1. Set Up Python Environment and Install Ansible
Ansible is written in Python, so we’ll begin by creating an isolated Python virtual environment. This keeps dependencies contained and avoids conflicts with system-wide Python packages.