david_igou.routeros_configuration.command role – Run arbitrary RouterOS API commands (escape hatch).
Note
This role is part of the david_igou.routeros_configuration collection (version 0.0.8-alpha).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it use: ansible-galaxy collection install david_igou.routeros_configuration.
To use it in a playbook, specify: david_igou.routeros_configuration.command.
Entry point main – Run arbitrary RouterOS API commands (escape hatch).
Synopsis
Each entry is passed to
community.routeros.api. Not idempotent.
Parameters
Parameter |
Comments |
|---|---|
API hostname/IP of the device. Default: |
|
API password. Secret — supply via vault. |
|
TCP port; empty lets the module choose from tls. Default: |
|
Use TLS (api-ssl). Choices:
|
|
API username. Default: |
|
Validate the device TLS certificate. Choices:
|
|
Commands to run. Default: |
|
Add arguments (key=value …). |
|
Arbitrary command in the path (e.g. “run .id=*1”). |
|
Hide this command from logs (set when it carries a secret). Choices:
|
|
API path (e.g. “system script”). |
|
.id to remove. |
|
Update arguments (.id=… key=value …). |
Examples
# Escape hatch for operations the declarative configure role does not cover.
# NOT idempotent — prefer configure where possible.
#
# cmd op — set the system note.
- hosts: routers
gather_facts: false
roles:
- role: david_igou.routeros_configuration.command
vars:
routeros_command:
- path: system note
cmd: set note=managed-by-ansible
# add op — create an entry with key=value arguments.
- hosts: routers
gather_facts: false
roles:
- role: david_igou.routeros_configuration.command
vars:
routeros_command:
- path: ip firewall address-list
add: list=blocklist address=198.51.100.7
# remove op — delete an entry by its .id. Set no_log: true on any command
# whose arguments carry a secret.
- hosts: routers
gather_facts: false
roles:
- role: david_igou.routeros_configuration.command
vars:
routeros_command:
- path: ip firewall address-list
remove: "*1"