community / community.routeros / 2.14.0 / module / api_info Retrieve information from API | "added in version" 2.2.0 of community.routeros" Authors: Felix Fontein (@felixfontein)community.routeros.api_info (2.14.0) — module
Install with ansible-galaxy collection install community.routeros:==2.14.0
collections: - name: community.routeros version: 2.14.0
Allows to retrieve information for a path using the API.
This can be used to backup a path to restore it with the M(community.routeros.api_modify) module.
Entries are normalized, dynamic and builtin entries are not returned. Use the O(handle_disabled) and O(hide_defaults) options to control normalization, the O(include_dynamic) and O(include_builtin) options to also return dynamic resp. builtin entries, and use O(unfiltered) to return all fields including counters.
B(Note) that this module is still heavily in development, and only supports B(some) paths. If you want to support new paths, or think you found problems with existing paths, please first L(create an issue in the community.routeros Issue Tracker,https://github.com/ansible-collections/community.routeros/issues/).
--- - 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
tls: aliases: - ssl default: false description: - If is set TLS will be used for RouterOS API connection. required: false type: bool path: choices: - caps-man aaa - caps-man access-list - caps-man channel - caps-man configuration - caps-man datapath - caps-man manager - caps-man manager interface - caps-man provisioning - caps-man security - certificate settings - interface bonding - interface bridge - interface bridge mlag - interface bridge port - interface bridge port-controller - interface bridge port-extender - interface bridge settings - interface bridge vlan - interface detect-internet - interface eoip - interface ethernet - interface ethernet poe - interface ethernet switch - interface ethernet switch port - interface gre - interface gre6 - interface l2tp-server server - interface list - interface list member - interface ovpn-client - interface ovpn-server server - interface ppp-client - interface pppoe-client - interface pptp-server server - interface sstp-server server - interface vlan - interface vrrp - interface wifi - interface wifi aaa - interface wifi access-list - interface wifi cap - interface wifi capsman - interface wifi channel - interface wifi configuration - interface wifi datapath - interface wifi interworking - interface wifi provisioning - interface wifi security - interface wifi steering - interface wifiwave2 - interface wifiwave2 aaa - interface wifiwave2 access-list - interface wifiwave2 cap - interface wifiwave2 capsman - interface wifiwave2 channel - interface wifiwave2 configuration - interface wifiwave2 datapath - interface wifiwave2 interworking - interface wifiwave2 provisioning - interface wifiwave2 security - interface wifiwave2 steering - interface wireguard - interface wireguard peers - interface wireless - interface wireless align - interface wireless cap - interface wireless security-profiles - interface wireless sniffer - interface wireless snooper - iot modbus - ip accounting - ip accounting web-access - ip address - ip arp - ip cloud - ip cloud advanced - ip dhcp-client - ip dhcp-client option - ip dhcp-server - ip dhcp-server config - ip dhcp-server lease - ip dhcp-server network - ip dhcp-server option - ip dhcp-server option sets - ip dns - ip dns static - ip firewall address-list - ip firewall connection tracking - ip firewall filter - ip firewall layer7-protocol - ip firewall mangle - ip firewall nat - ip firewall raw - ip firewall service-port - ip hotspot service-port - ip ipsec identity - ip ipsec peer - ip ipsec policy - ip ipsec profile - ip ipsec proposal - ip ipsec settings - ip neighbor discovery-settings - ip pool - ip proxy - ip route - ip route vrf - ip service - ip settings - ip smb - ip socks - ip ssh - ip tftp settings - ip traffic-flow - ip traffic-flow ipfix - ip traffic-flow target - ip upnp - ip upnp interfaces - ip vrf - ipv6 address - ipv6 dhcp-client - ipv6 dhcp-server - ipv6 dhcp-server option - ipv6 firewall address-list - ipv6 firewall filter - ipv6 firewall mangle - ipv6 firewall nat - ipv6 firewall raw - ipv6 nd - ipv6 nd prefix default - ipv6 route - ipv6 settings - mpls - mpls ldp - port firmware - port remote-access - ppp aaa - ppp profile - queue interface - queue tree - radius - radius incoming - routing bgp connection - routing bgp instance - routing bgp template - routing filter rule - routing filter select-rule - routing id - routing mme - routing ospf area - routing ospf area range - routing ospf instance - routing ospf interface-template - routing pimsm instance - routing pimsm interface-template - routing rip - routing ripng - routing rule - routing table - snmp - snmp community - system clock - system clock manual - system identity - system leds settings - system logging - system logging action - system note - system ntp client - system ntp client servers - system ntp server - system package update - system routerboard settings - system scheduler - system script - system upgrade mirror - system ups - system watchdog - tool bandwidth-server - tool e-mail - tool graphing - tool graphing interface - tool graphing resource - tool mac-server - tool mac-server mac-winbox - tool mac-server ping - tool netwatch - tool romon - tool sms - tool sniffer - tool traffic-generator - user - user aaa - user group - user settings description: - Path to query. - An example value is V(ip address). This is equivalent to running C(/ip address print) in the RouterOS CLI. required: true type: str port: description: - RouterOS api port. If O(tls) is set, port will apply to TLS/SSL connection. - Defaults are V(8728) for the HTTP API, and V(8729) for the HTTPS API. type: int ca_path: description: - PEM formatted file that contains a CA certificate to be used for certificate validation. - See also O(validate_cert_hostname). Only used when O(tls=true) and O(validate_certs=true). type: path version_added: 1.2.0 version_added_collection: community.routeros timeout: default: 10 description: - Timeout for the request. type: int version_added: 2.3.0 version_added_collection: community.routeros encoding: default: ASCII description: - Use the specified encoding when communicating with the RouterOS device. - Default is V(ASCII). Note that V(UTF-8) requires librouteros 3.2.1 or newer. type: str version_added: 2.1.0 version_added_collection: community.routeros hostname: description: - RouterOS hostname API. required: true type: str password: description: - RouterOS user password. required: true type: str username: description: - RouterOS login user. required: true type: str unfiltered: default: false description: - Whether to output all fields, and not just the ones supported as input for M(community.routeros.api_modify). - Unfiltered output can contain counters and other state information. type: bool force_no_cert: default: false description: - Set to V(true) to connect without a certificate when O(tls=true). - See also O(validate_certs). - B(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 O(validate_certs) and O(ca_path). type: bool version_added: 2.4.0 version_added_collection: community.routeros hide_defaults: default: true description: - Whether to hide default values. type: bool validate_certs: default: true description: - Set to V(false) to skip validation of TLS certificates. - See also O(validate_cert_hostname). Only used when O(tls=true). - B(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 O(ca_path) option. type: bool version_added: 1.2.0 version_added_collection: community.routeros handle_disabled: choices: - exclamation - null-value - omit default: exclamation description: - How to handle unset values. - V(exclamation) prepends the keys with V(!) in the output with value V(null). - V(null-value) uses the regular key with value V(null). - V(omit) omits these values from the result. type: str include_builtin: default: false description: - Whether to include builtin values. - By default, they are not returned, and the C(builtin) keys are omitted. - If set to V(true), they are returned as well, and the C(builtin) keys are returned as well. type: bool version_added: 2.4.0 version_added_collection: community.routeros include_dynamic: default: false description: - Whether to include dynamic values. - By default, they are not returned, and the C(dynamic) keys are omitted. - If set to V(true), they are returned as well, and the C(dynamic) keys are returned as well. type: bool include_read_only: default: false description: - Whether to include read-only fields. - By default, they are not returned. type: bool version_added: 2.10.0 version_added_collection: community.routeros validate_cert_hostname: default: false description: - Set to V(true) to validate hostnames in certificates. - See also O(validate_certs). Only used when O(tls=true) and O(validate_certs=true). type: bool version_added: 1.2.0 version_added_collection: community.routeros
result: description: A list of all elements for the current path. elements: dict returned: always sample: - .id: '*1' actual-interface: bridge address: 192.168.88.1/24 comment: defconf disabled: false dynamic: false interface: bridge invalid: false network: 192.168.88.0 type: list