community.routeros.api_info module – Retrieve information from API
Note
This module is part of the community.routeros collection (version 2.20.0).
You might already have this collection installed if you are using the ansible
package.
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 community.routeros
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.routeros.api_info
.
New in community.routeros 2.2.0
Synopsis
Allows to retrieve information for a path using the API.
This can be used to backup a path to restore it with the community.routeros.api_modify module.
Entries are normalized, dynamic and builtin entries are not returned. Use the
handle_disabled
andhide_defaults
options to control normalization, theinclude_dynamic
andinclude_builtin
options to also return dynamic resp. builtin entries, and useunfiltered
to return all fields including counters.Note that this module is still heavily in development, and only supports some paths. If you want to support new paths, or think you found problems with existing paths, please first create an issue in the community.routeros Issue Tracker.
Requirements
The below requirements are needed on the host that executes this module.
librouteros
Python >= 3.6 (for librouteros)
Parameters
Parameter |
Comments |
---|---|
PEM formatted file that contains a CA certificate to be used for certificate validation. See also |
|
Use the specified encoding when communicating with the RouterOS device. Default is Default: |
|
Set to See also Note: this forces the use of anonymous Diffie-Hellman (ADH) ciphers. The protocol is susceptible to Man-in-the-Middle attacks, because the keys used in the exchange are not authenticated. Instead of simply connecting without a certificate to “make things work” have a look at Choices:
|
|
How to handle unset values.
Choices:
|
|
Whether to hide default values. Choices:
|
|
RouterOS hostname API. |
|
Whether to include builtin values. By default, they are not returned, and the If set to Choices:
|
|
Whether to include dynamic values. By default, they are not returned, and the If set to Choices:
|
|
Whether to include read-only fields. By default, they are not returned. Choices:
|
|
RouterOS user password. |
|
Path to query. An example value is Choices:
|
|
RouterOS api port. If Defaults are |
|
Restrict output to entries matching the following criteria. |
|
The field whose values to restrict. |
|
Invert the condition. This affects Choices:
|
|
Whether disabled or not provided values should match. Choices:
|
|
A regular expression matching values of the field to limit to. Note that all values will be converted to strings before matching. It is not possible to match disabled values with regular expressions. Set |
|
The values of the field to limit to. Note that the types of the values are important. If you provide a string |
|
Timeout for the request. Default: |
|
If is set TLS will be used for RouterOS API connection. Choices:
|
|
Whether to output all fields, and not just the ones supported as input for community.routeros.api_modify. Unfiltered output can contain counters and other state information. Choices:
|
|
RouterOS login user. |
|
Set to See also Choices:
|
|
Set to See also Note: instead of simply deactivating certificate validations to “make things work”, please consider creating your own CA certificate and using it to sign certificates used for your router. You can tell the module about your CA certificate with the Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Action group: community.routeros.api |
Use |
|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Will return details on what has changed (or possibly needs changing in |
|
Platform: RouterOS |
Target OS/families that can be operated against. |
See Also
See also
- community.routeros.api
Ansible module for RouterOS API.
- community.routeros.api_facts
Collect facts from remote devices running MikroTik RouterOS using the API.
- community.routeros.api_find_and_modify
Find and modify information using the API.
- community.routeros.api_modify
Modify data at paths with API.
- How to connect to RouterOS devices with the RouterOS API
How to connect to RouterOS devices with the RouterOS API
Examples
---
- name: Get IP addresses
community.routeros.api_info:
hostname: "{{ hostname }}"
password: "{{ password }}"
username: "{{ username }}"
path: ip address
register: ip_addresses
- name: Print data for IP addresses
ansible.builtin.debug:
var: ip_addresses.result
- name: Get IP addresses
community.routeros.api_info:
hostname: "{{ hostname }}"
password: "{{ password }}"
username: "{{ username }}"
path: ip address
register: ip_addresses
- name: Print data for IP addresses
ansible.builtin.debug:
var: ip_addresses.result
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A list of all elements for the current path. Returned: always Sample: |