community / community.routeros / 2.14.0 / module / api_facts Collect facts from remote devices running MikroTik RouterOS using the API | "added in version" 2.1.0 of community.routeros" Authors: Egor Zaitsev (@heuels), Nikolay Dachev (@NikolayDachev), Felix Fontein (@felixfontein)community.routeros.api_facts (2.14.0) — module
Install with ansible-galaxy collection install community.routeros:==2.14.0
collections: - name: community.routeros version: 2.14.0
Collects a base set of device facts from a remote device that is running RouterOS. This module prepends all of the base network fact keys with C(ansible_net_<fact>). The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts.
As opposed to the M(community.routeros.facts) module, it uses the RouterOS API, similar to the M(community.routeros.api) module.
- name: Collect all facts from the device community.routeros.api_facts: hostname: 192.168.88.1 username: admin password: password gather_subset: all
- name: Do not collect hardware facts community.routeros.api_facts: hostname: 192.168.88.1 username: admin password: password gather_subset: - "!hardware"
tls: aliases: - ssl default: false description: - If is set TLS will be used for RouterOS API connection. required: false type: bool 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 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 gather_subset: default: - all description: - When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include V(all), V(hardware), V(interfaces), and V(routing). - Can specify a list of values to include a larger subset. Values can also be used with an initial V(!) to specify that a specific subset should not be collected. elements: str required: false type: list 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 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
ansible_facts: contains: ansible_net_all_ipv4_addresses: description: All IPv4 addresses configured on the device. returned: O(gather_subset) contains V(interfaces) type: list ansible_net_all_ipv6_addresses: description: All IPv6 addresses configured on the device. returned: O(gather_subset) contains V(interfaces) type: list ansible_net_arch: description: The CPU architecture of the device. returned: O(gather_subset) contains V(default) type: str ansible_net_bgp_instance: description: A dictionary with BGP instance information. returned: O(gather_subset) contains V(routing) type: dict ansible_net_bgp_peer: description: A dictionary with BGP peer information. returned: O(gather_subset) contains V(routing) type: dict ansible_net_bgp_vpnv4_route: description: A dictionary with BGP vpnv4 route information. returned: O(gather_subset) contains V(routing) type: dict ansible_net_cpu_load: description: Current CPU load. returned: O(gather_subset) contains V(default) type: str ansible_net_gather_subset: description: The list of fact subsets collected from the device. returned: always type: list ansible_net_hostname: description: The configured hostname of the device. returned: O(gather_subset) contains V(default) type: str ansible_net_interfaces: description: A hash of all interfaces running on the system. returned: O(gather_subset) contains V(interfaces) type: dict ansible_net_memfree_mb: description: The available free memory on the remote device in MiB. returned: O(gather_subset) contains V(hardware) type: int ansible_net_memtotal_mb: description: The total memory on the remote device in MiB. returned: O(gather_subset) contains V(hardware) type: int ansible_net_model: description: The model name returned from the device. returned: O(gather_subset) contains V(default) type: str ansible_net_neighbors: description: The list of neighbors from the remote device. returned: O(gather_subset) contains V(interfaces) type: dict ansible_net_ospf_instance: description: A dictionary with OSPF instances. returned: O(gather_subset) contains V(routing) type: dict ansible_net_ospf_neighbor: description: A dictionary with OSPF neighbors. returned: O(gather_subset) contains V(routing) type: dict ansible_net_route: description: A dictionary for routes in all routing tables. returned: O(gather_subset) contains V(routing) type: dict ansible_net_serialnum: description: The serial number of the remote device. returned: O(gather_subset) contains V(default) type: str ansible_net_spacefree_mb: description: The available disk space on the remote device in MiB. returned: O(gather_subset) contains V(hardware) type: dict ansible_net_spacetotal_mb: description: The total disk space on the remote device in MiB. returned: O(gather_subset) contains V(hardware) type: dict ansible_net_uptime: description: The uptime of the device. returned: O(gather_subset) contains V(default) type: str ansible_net_version: description: The operating system version running on the remote device. returned: O(gather_subset) contains V(default) type: str description: Dictionary of IP geolocation facts for a host's IP address. returned: always type: dict