<linkrel="next"title="community.routeros.routeros cliconf – Use routeros cliconf to run command on MikroTik RouterOS platform"href="routeros_cliconf.html"/>
<linkrel="prev"title="community.routeros.command module – Run commands on remote devices running MikroTik RouterOS"href="command_module.html"/><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
</head>
<bodyclass="wy-body-for-nav"><!-- extra body elements for Ansible beyond RTD Sphinx Theme -->
<liclass="toctree-l1"><aclass="reference internal"href="docsite/api-guide.html">How to connect to RouterOS devices with the RouterOS API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="docsite/ssh-guide.html">How to connect to RouterOS devices with SSH</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="docsite/quoting.html">How to quote and unquote commands and arguments</a></li>
</ul>
<ulclass="current">
<liclass="toctree-l1"><aclass="reference internal"href="api_module.html">community.routeros.api module – Ansible module for RouterOS API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="api_facts_module.html">community.routeros.api_facts module – Collect facts from remote devices running MikroTik RouterOS using the API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="api_find_and_modify_module.html">community.routeros.api_find_and_modify module – Find and modify information using the API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="api_info_module.html">community.routeros.api_info module – Retrieve information from API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="api_modify_module.html">community.routeros.api_modify module – Modify data at paths with API</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="command_module.html">community.routeros.command module – Run commands on remote devices running MikroTik RouterOS</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="routeros_cliconf.html">community.routeros.routeros cliconf – Use routeros cliconf to run command on MikroTik RouterOS platform</a></li>
</ul>
<ul>
<liclass="toctree-l1"><aclass="reference internal"href="join_filter.html">community.routeros.join filter – Join a list of arguments to a command</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="list_to_dict_filter.html">community.routeros.list_to_dict filter – Convert a list of arguments to a dictionary</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="quote_argument_filter.html">community.routeros.quote_argument filter – Quote an argument</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="quote_argument_value_filter.html">community.routeros.quote_argument_value filter – Quote an argument value</a></li>
<liclass="toctree-l1"><aclass="reference internal"href="split_filter.html">community.routeros.split filter – Split a command into arguments</a></li>
</ul>
<!-- extra nav elements for Ansible beyond RTD Sphinx Theme -->
<ahref="https://github.com/ansible-collections/community.routeros/edit/main/plugins/modules/facts.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!—%20Your%20description%20here%20–%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr"class="fa fa-github"> Edit on GitHub</a>
<h1>community.routeros.facts module – Collect facts from remote devices running MikroTik RouterOS<aclass="headerlink"href="#community-routeros-facts-module-collect-facts-from-remote-devices-running-mikrotik-routeros"title="Link to this heading"></a></h1>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>This module is part of the <aclass="reference external"href="https://galaxy.ansible.com/ui/repo/published/community/routeros/">community.routeros collection</a> (version 2.20.0).</p>
<p>It is not included in <codeclass="docutils literal notranslate"><spanclass="pre">ansible-core</span></code>.
To check whether it is installed, run <codeclass="code docutils literal notranslate"><spanclass="pre">ansible-galaxy</span><spanclass="pre">collection</span><spanclass="pre">list</span></code>.</p>
<h2><aclass="toc-backref"href="#id1"role="doc-backlink">Synopsis</a><aclass="headerlink"href="#synopsis"title="Link to this heading"></a></h2>
<ulclass="simple">
<li><p>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 <codeclass="docutils literal notranslate"><spanclass="pre">ansible_net_<fact></span></code>. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts.</p></li>
</ul>
</section>
<sectionid="parameters">
<h2><aclass="toc-backref"href="#id2"role="doc-backlink">Parameters</a><aclass="headerlink"href="#parameters"title="Link to this heading"></a></h2>
<aclass="ansibleOptionLink"href="#parameter-gather_subset"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include <codeclass="ansible-value docutils literal notranslate"><spanclass="pre">all</span></code>, <codeclass="ansible-value docutils literal notranslate"><spanclass="pre">hardware</span></code>, <codeclass="ansible-value docutils literal notranslate"><spanclass="pre">config</span></code>, <codeclass="ansible-value docutils literal notranslate"><spanclass="pre">interfaces</span></code>, and <codeclass="ansible-value docutils literal notranslate"><spanclass="pre">routing</span></code>.</p>
<p>Can specify a list of values to include a larger subset. Values can also be used with an initial <codeclass="ansible-value docutils literal notranslate"><spanclass="pre">!</span></code> to specify that a specific subset should not be collected.</p>
<td><divclass="ansible-option-cell"><p>Can run in <codeclass="docutils literal notranslate"><spanclass="pre">check_mode</span></code> and return changed status prediction without modifying target.</p>
<td><divclass="ansible-option-cell"><p>Will return details on what has changed (or possibly needs changing in <codeclass="docutils literal notranslate"><spanclass="pre">check_mode</span></code>), when in diff mode.</p>
<td><divclass="ansible-option-cell"><p>Action returns an <codeclass="docutils literal notranslate"><spanclass="pre">ansible_facts</span></code> dictionary that will update existing host facts.</p>
<td><divclass="ansible-option-cell"><p>Target OS/families that can be operated against.</p>
</div></td>
</tr>
</tbody>
</table>
</section>
<sectionid="see-also">
<h2><aclass="toc-backref"href="#id4"role="doc-backlink">See Also</a><aclass="headerlink"href="#see-also"title="Link to this heading"></a></h2>
<divclass="admonition seealso">
<pclass="admonition-title">See also</p>
<dlclass="simple">
<dt><aclass="reference internal"href="docsite/ssh-guide.html#ansible-collections-community-routeros-docsite-ssh-guide"><spanclass="std std-ref">How to connect to RouterOS devices with SSH</span></a></dt><dd><p>How to connect to RouterOS devices with SSH</p>
</dd>
</dl>
</div>
</section>
<sectionid="examples">
<h2><aclass="toc-backref"href="#id5"role="doc-backlink">Examples</a><aclass="headerlink"href="#examples"title="Link to this heading"></a></h2>
<divclass="highlight-yaml+jinja notranslate"><divclass="highlight"><pre><span></span><spanclass="p p-Indicator">-</span><spanclass="w"></span><spanclass="nt">name</span><spanclass="p">:</span><spanclass="w"></span><spanclass="l l-Scalar l-Scalar-Plain">Collect all facts from the device</span>
<spanclass="p p-Indicator">-</span><spanclass="w"></span><spanclass="nt">name</span><spanclass="p">:</span><spanclass="w"></span><spanclass="l l-Scalar l-Scalar-Plain">Collect only the config and default facts</span>
<h2><aclass="toc-backref"href="#id6"role="doc-backlink">Returned Facts</a><aclass="headerlink"href="#returned-facts"title="Link to this heading"></a></h2>
<p>Facts returned by this module are added/updated in the <codeclass="docutils literal notranslate"><spanclass="pre">hostvars</span></code> host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_all_ipv4_addresses"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>All IPv4 addresses configured on the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_all_ipv6_addresses"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>All IPv6 addresses configured on the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_arch"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The CPU architecture of the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_bgp_instance"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A dictionary with BGP instance information.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_bgp_peer"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A dictionary with BGP peer information.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_bgp_vpnv4_route"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A dictionary with BGP vpnv4 route information.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_config"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The current active config from the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_config_nonverbose"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
<p><emclass="ansible-option-versionadded">added in community.routeros 1.2.0</em></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The current active config from the device in minimal form.</p>
<p>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 <codeclass="docutils literal notranslate"><spanclass="pre">/export</span></code> and stripping the timestamp from the comment in the first line.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_cpu_load"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Current CPU load.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_gather_subset"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The list of fact subsets collected from the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_hostname"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The configured hostname of the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_interfaces"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A hash of all interfaces running on the system.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_memfree_mb"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">integer</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The available free memory on the remote device in MiB.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_memtotal_mb"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">integer</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The total memory on the remote device in MiB.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_model"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The model name returned from the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_neighbors"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The list of neighbors from the remote device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_ospf_instance"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A dictionary with OSPF instances.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_ospf_neighbor"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A dictionary with OSPF neighbors.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_route"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>A dictionary for routes in all routing tables.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_serialnum"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The serial number of the remote device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_spacefree_mb"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The available disk space on the remote device in MiB.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_spacetotal_mb"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The total disk space on the remote device in MiB.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_uptime"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The uptime of the device.</p>
<aclass="ansibleOptionLink"href="#return-ansible_facts/ansible_net_version"title="Permalink to this return value"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>The operating system version running on the remote device.</p>
<li><span><aaria-role="button"class="ansible-link reference external"href="https://forum.ansible.com/tags/c/help/6/none/routeros"rel="noopener external"target="_blank">Ask for help (RouterOS)</a></span></li>
<li><span><aaria-role="button"class="ansible-link reference external"href="https://github.com/ansible-collections/community.routeros/issues/new?assignees=&labels=&template=bug_report.md"rel="noopener external"target="_blank">Submit a bug report</a></span></li>
<li><span><aaria-role="button"class="ansible-link reference external"href="https://github.com/ansible-collections/community.routeros/issues/new?assignees=&labels=&template=feature_request.md"rel="noopener external"target="_blank">Request a feature</a></span></li>
<ahref="command_module.html"class="btn btn-neutral float-left"title="community.routeros.command module – Run commands on remote devices running MikroTik RouterOS"accesskey="p"rel="prev"><spanclass="fa fa-arrow-circle-left"aria-hidden="true"></span> Previous</a>
<ahref="routeros_cliconf.html"class="btn btn-neutral float-right"title="community.routeros.routeros cliconf – Use routeros cliconf to run command on MikroTik RouterOS platform"accesskey="n"rel="next">Next <spanclass="fa fa-arrow-circle-right"aria-hidden="true"></span></a>