community.routeros.api_info module – Retrieve information from API
Note
This module is part of the community.routeros collection (version 2.5.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 and hide_defaults options to control normalization, the include_dynamic and include_builtin options to also return dynamic resp. builtin entries, and use unfiltered 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 validate_cert_hostname. Only used when tls=true and validate_certs=true. |
|
Use the specified encoding when communicating with the RouterOS device. Default is Default: |
|
Set to See also validate_certs. 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 validate_certs and ca_path. 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:
|
|
RouterOS user password. |
|
Path to query. An example value is Choices:
|
|
RouterOS api port. If tls is set, port will apply to TLS/SSL connection. Defaults are |
|
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 validate_certs. Only used when tls=true and validate_certs=true. Choices:
|
|
Set to See also validate_cert_hostname. Only used when tls=true. 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 ca_path option. 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
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: |
Collection links
Issue Tracker Repository (Sources) Submit a bug report Request a feature Communication