community.routeros.facts (2.14.0) — module

Collect facts from remote devices running MikroTik RouterOS

Authors: Egor Zaitsev (@heuels)

Install collection

Install with ansible-galaxy collection install community.routeros:==2.14.0


Add to requirements.yml

  collections:
    - name: community.routeros
      version: 2.14.0

Description

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.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Collect all facts from the device
  community.routeros.facts:
    gather_subset: all
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Collect only the config and default facts
  community.routeros.facts:
    gather_subset:
      - config
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Do not collect hardware facts
  community.routeros.facts:
    gather_subset:
      - "!hardware"

Inputs

    
gather_subset:
    default:
    - '!config'
    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(config), 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

Outputs

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_config:
      description: The current active config from the device.
      returned: O(gather_subset) contains V(config)
      type: str
    ansible_net_config_nonverbose:
      description:
      - The current active config from the device in minimal form.
      - This value is idempotent in the sense that if the facts module is run twice
        and the device's config was not changed between the runs, the value is identical.
        This is achieved by running C(/export) and stripping the timestamp from the
        comment in the first line.
      returned: O(gather_subset) contains V(config)
      type: str
      version_added: 1.2.0
      version_added_collection: community.routeros
    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

See also