<linkrel="next"title="community.routeros.api_facts module – Collect facts from remote devices running MikroTik RouterOS using the API"href="api_facts_module.html"/>
<linkrel="prev"title="How to quote and unquote commands and arguments"href="docsite/quoting.html"/><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
<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>
<liclass="breadcrumb-item active">community.routeros.api module – Ansible module for RouterOS API</li>
<liclass="wy-breadcrumbs-aside">
<!-- User defined GitHub URL -->
<ahref="https://github.com/ansible-collections/community.routeros/edit/main/plugins/modules/api.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.api module – Ansible module for RouterOS API<aclass="headerlink"href="#community-routeros-api-module-ansible-module-for-routeros-api"title="Permalink to this heading"></a></h1>
<p>This module is part of the <aclass="reference external"href="https://galaxy.ansible.com/community/routeros">community.routeros collection</a> (version 2.5.0).</p>
You need further requirements to be able to use this module,
see <aclass="reference internal"href="#ansible-collections-community-routeros-api-module-requirements"><spanclass="std std-ref">Requirements</span></a> for details.</p>
<p>To use it in a playbook, specify: <codeclass="code docutils literal notranslate"><spanclass="pre">community.routeros.api</span></code>.</p>
<h2><aclass="toc-backref"href="#id1">Synopsis</a><aclass="headerlink"href="#synopsis"title="Permalink to this heading"></a></h2>
<ulclass="simple">
<li><p>Ansible module for RouterOS API with the Python <codeclass="docutils literal notranslate"><spanclass="pre">librouteros</span></code> library.</p></li>
<li><p>This module can add, remove, update, query and execute arbitrary command in RouterOS via API.</p></li>
</ul>
</section>
<sectionid="requirements">
<spanid="ansible-collections-community-routeros-api-module-requirements"></span><h2><aclass="toc-backref"href="#id2">Requirements</a><aclass="headerlink"href="#requirements"title="Permalink to this heading"></a></h2>
<p>The below requirements are needed on the host that executes this module.</p>
<aclass="ansibleOptionLink"href="#parameter-add"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Will add selected arguments in selected path to RouterOS config.</p>
<aclass="ansibleOptionLink"href="#parameter-ca_path"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">path</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 1.2.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>PEM formatted file that contains a CA certificate to be used for certificate validation.</p>
<p>See also <em>validate_cert_hostname</em>. Only used when <em>tls=true</em> and <em>validate_certs=true</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-cmd"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Execute any/arbitrary command in selected path, after the command we can add <codeclass="docutils literal notranslate"><spanclass="pre">.id</span></code>.</p>
<p>Example path <codeclass="docutils literal notranslate"><spanclass="pre">system</span><spanclass="pre">script</span></code> and cmd <codeclass="docutils literal notranslate"><spanclass="pre">run</span><spanclass="pre">.id=*03</span></code> is equivalent in RouterOS CLI <codeclass="docutils literal notranslate"><spanclass="pre">/system</span><spanclass="pre">script</span><spanclass="pre">run</span><spanclass="pre">number=0</span></code>.</p>
<p>Example path <codeclass="docutils literal notranslate"><spanclass="pre">ip</span><spanclass="pre">address</span></code> and cmd <codeclass="docutils literal notranslate"><spanclass="pre">print</span></code> is equivalent in RouterOS CLI <codeclass="docutils literal notranslate"><spanclass="pre">/ip</span><spanclass="pre">address</span><spanclass="pre">print</span></code>.</p>
<aclass="ansibleOptionLink"href="#parameter-encoding"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.1.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Use the specified encoding when communicating with the RouterOS device.</p>
<p>Default is <codeclass="docutils literal notranslate"><spanclass="pre">ASCII</span></code>. Note that <codeclass="docutils literal notranslate"><spanclass="pre">UTF-8</span></code> requires librouteros 3.2.1 or newer.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">dictionary</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Extended query given path for selected query attributes from RouterOS API.</p>
<p>Extended query allow conjunctive input. If there is no matching entry, an empty list will be returned.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/attributes"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=string</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>The list of attributes to return.</p>
<p>Every attribute used in a <em>where</em> clause need to be listed here.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=dictionary</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>Allows to restrict the objects returned.</p>
<p>The conditions here must all match. An <em>or</em> condition needs at least one of its conditions to match.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where/attribute"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>The attribute to match. Must be part of <em>attributes</em>.</p>
<p>Either <em>or</em> or all of <em>attribute</em>, <em>is</em>, and <em>value</em> have to be specified.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where/is"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>The operator to use for matching.</p>
<p>For equality use <codeclass="docutils literal notranslate"><spanclass="pre">==</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">eq</span></code>. For less use <codeclass="docutils literal notranslate"><spanclass="pre"><</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">less</span></code>. For more use <codeclass="docutils literal notranslate"><spanclass="pre">></span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">more</span></code>.</p>
<p>Use <codeclass="docutils literal notranslate"><spanclass="pre">in</span></code> to check whether the value is part of a list. In that case, <em>value</em> must be a list.</p>
<p>Either <em>or</em> or all of <em>attribute</em>, <em>is</em>, and <em>value</em> have to be specified.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where/or"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">list</span> / <spanclass="ansible-option-elements">elements=dictionary</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>A list of conditions so that at least one of them has to match.</p>
<p>Either <em>or</em> or all of <em>attribute</em>, <em>is</em>, and <em>value</em> have to be specified.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where/or/attribute"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>The attribute to match. Must be part of <em>attributes</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where/or/is"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>The operator to use for matching.</p>
<p>For equality use <codeclass="docutils literal notranslate"><spanclass="pre">==</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">eq</span></code>. For less use <codeclass="docutils literal notranslate"><spanclass="pre"><</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">less</span></code>. For more use <codeclass="docutils literal notranslate"><spanclass="pre">></span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">more</span></code>.</p>
<p>Use <codeclass="docutils literal notranslate"><spanclass="pre">in</span></code> to check whether the value is part of a list. In that case, <em>value</em> must be a list.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where/or/value"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">any</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>The value to compare to. Must be a list for <em>is=in</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-extended_query/where/value"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">any</span></p>
</div></td>
<td><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-indent-desc"></div><divclass="ansible-option-cell"><p>The value to compare to. Must be a list for <em>is=in</em>.</p>
<p>Either <em>or</em> or all of <em>attribute</em>, <em>is</em>, and <em>value</em> have to be specified.</p>
<aclass="ansibleOptionLink"href="#parameter-force_no_cert"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.4.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Set to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code> to connect without a certificate when <em>tls=true</em>.</p>
<p>See also <em>validate_certs</em>.</p>
<p><strong>Note:</strong> 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 <em>validate_certs</em> and <em>ca_path</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-hostname"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
<aclass="ansibleOptionLink"href="#parameter-password"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>RouterOS user password.</p>
<aclass="ansibleOptionLink"href="#parameter-path"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Main path for all other arguments.</p>
<p>If other arguments are not set, api will return all items in selected path.</p>
<aclass="ansibleOptionLink"href="#parameter-port"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">integer</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>RouterOS api port. If <em>tls</em> is set, port will apply to TLS/SSL connection.</p>
<p>Defaults are <codeclass="docutils literal notranslate"><spanclass="pre">8728</span></code> for the HTTP API, and <codeclass="docutils literal notranslate"><spanclass="pre">8729</span></code> for the HTTPS API.</p>
<aclass="ansibleOptionLink"href="#parameter-query"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Query given path for selected query attributes from RouterOS aip.</p>
<p>WHERE is key word which extend query. WHERE format is key operator value - with spaces.</p>
<p>WHERE valid operators are <codeclass="docutils literal notranslate"><spanclass="pre">==</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">eq</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">!=</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">not</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">></span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">more</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre"><</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">less</span></code>.</p>
<p>Example path <codeclass="docutils literal notranslate"><spanclass="pre">ip</span><spanclass="pre">address</span></code> and query <codeclass="docutils literal notranslate"><spanclass="pre">.id</span><spanclass="pre">address</span></code> will return only <codeclass="docutils literal notranslate"><spanclass="pre">.id</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">address</span></code> for all items in <codeclass="docutils literal notranslate"><spanclass="pre">ip</span><spanclass="pre">address</span></code> path.</p>
<p>Example path <codeclass="docutils literal notranslate"><spanclass="pre">ip</span><spanclass="pre">address</span></code> and query <codeclass="docutils literal notranslate"><spanclass="pre">.id</span><spanclass="pre">address</span><spanclass="pre">WHERE</span><spanclass="pre">address</span><spanclass="pre">==</span><spanclass="pre">1.1.1.3/32</span></code>. will return only <codeclass="docutils literal notranslate"><spanclass="pre">.id</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">address</span></code> for items in <codeclass="docutils literal notranslate"><spanclass="pre">ip</span><spanclass="pre">address</span></code> path, where address is eq to 1.1.1.3/32.</p>
<p>Example path <codeclass="docutils literal notranslate"><spanclass="pre">interface</span></code> and query <codeclass="docutils literal notranslate"><spanclass="pre">mtu</span><spanclass="pre">name</span><spanclass="pre">WHERE</span><spanclass="pre">mut</span><spanclass="pre">></span><spanclass="pre">1400</span></code> will return only interfaces <codeclass="docutils literal notranslate"><spanclass="pre">mtu,name</span></code> where mtu is bigger than 1400.</p>
<p>Equivalent in RouterOS CLI <codeclass="docutils literal notranslate"><spanclass="pre">/interface</span><spanclass="pre">print</span><spanclass="pre">where</span><spanclass="pre">mtu</span><spanclass="pre">></span><spanclass="pre">1400</span></code>.</p>
<aclass="ansibleOptionLink"href="#parameter-remove"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Remove config/value from RouterOS by ‘.id’.</p>
<p>Example <codeclass="docutils literal notranslate"><spanclass="pre">*03</span></code> will remove config/value with <codeclass="docutils literal notranslate"><spanclass="pre">id=*03</span></code> in selected path.</p>
<p>Equivalent in RouterOS CLI <codeclass="docutils literal notranslate"><spanclass="pre">/ip</span><spanclass="pre">address</span><spanclass="pre">remove</span><spanclass="pre">numbers=1</span></code>.</p>
<p>Note <codeclass="docutils literal notranslate"><spanclass="pre">number</span></code> in RouterOS CLI is different from <codeclass="docutils literal notranslate"><spanclass="pre">.id</span></code>.</p>
<aclass="ansibleOptionLink"href="#parameter-timeout"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">integer</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.3.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Timeout for the request.</p>
<aclass="ansibleOptionLink"href="#parameter-tls"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-aliases">aliases: ssl</span></p>
<aclass="ansibleOptionLink"href="#parameter-update"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Update config/value in RouterOS by ‘.id’ in selected path.</p>
<p>Example <codeclass="docutils literal notranslate"><spanclass="pre">.id=*03</span><spanclass="pre">address=1.1.1.3/32</span></code> and path <codeclass="docutils literal notranslate"><spanclass="pre">ip</span><spanclass="pre">address</span></code> will replace existing ip address with <codeclass="docutils literal notranslate"><spanclass="pre">.id=*03</span></code>.</p>
<p>Equivalent in RouterOS CLI <codeclass="docutils literal notranslate"><spanclass="pre">/ip</span><spanclass="pre">address</span><spanclass="pre">set</span><spanclass="pre">address=1.1.1.3/32</span><spanclass="pre">numbers=1</span></code>.</p>
<p>Note <codeclass="docutils literal notranslate"><spanclass="pre">number</span></code> in RouterOS CLI is different from <codeclass="docutils literal notranslate"><spanclass="pre">.id</span></code>.</p>
<aclass="ansibleOptionLink"href="#parameter-username"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">string</span> / <spanclass="ansible-option-required">required</span></p>
<aclass="ansibleOptionLink"href="#parameter-validate_cert_hostname"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 1.2.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Set to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code> to validate hostnames in certificates.</p>
<p>See also <em>validate_certs</em>. Only used when <em>tls=true</em> and <em>validate_certs=true</em>.</p>
<aclass="ansibleOptionLink"href="#parameter-validate_certs"title="Permalink to this option"></a><pclass="ansible-option-type-line"><spanclass="ansible-option-type">boolean</span></p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 1.2.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> to skip validation of TLS certificates.</p>
<p>See also <em>validate_cert_hostname</em>. Only used when <em>tls=true</em>.</p>
<p><strong>Note:</strong> 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 <em>ca_path</em> option.</p>
<p><spanclass="ansible-option-versionadded">added in community.routeros 2.1.0</span></p>
</div></td>
<td><divclass="ansible-option-cell"><p>Use <codeclass="docutils literal notranslate"><spanclass="pre">group/community.routeros.api</span></code> in <codeclass="docutils literal notranslate"><spanclass="pre">module_defaults</span></code> to set defaults for this module.</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>Target OS/families that can be operated against.</p>
</div></td>
</tr>
</tbody>
</table>
</section>
<sectionid="notes">
<h2><aclass="toc-backref"href="#id5">Notes</a><aclass="headerlink"href="#notes"title="Permalink to this heading"></a></h2>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<ulclass="simple">
<li><p><em>add</em>, <em>remove</em>, <em>update</em>, <em>cmd</em> and <em>query</em> are mutually exclusive.</p></li>
<li><p>Use the <aclass="reference internal"href="api_modify_module.html#ansible-collections-community-routeros-api-modify-module"><spanclass="std std-ref">community.routeros.api_modify</span></a> and <aclass="reference internal"href="api_find_and_modify_module.html#ansible-collections-community-routeros-api-find-and-modify-module"><spanclass="std std-ref">community.routeros.api_find_and_modify</span></a> modules for more specific modifications, and the <aclass="reference internal"href="api_info_module.html#ansible-collections-community-routeros-api-info-module"><spanclass="std std-ref">community.routeros.api_info</span></a> module for a more controlled way of returning all entries for a path.</p></li>
</ul>
</div>
</section>
<sectionid="see-also">
<h2><aclass="toc-backref"href="#id6">See Also</a><aclass="headerlink"href="#see-also"title="Permalink to this heading"></a></h2>
<divclass="admonition seealso">
<pclass="admonition-title">See also</p>
<dlclass="simple">
<dt><aclass="reference internal"href="docsite/quoting.html#ansible-collections-community-routeros-docsite-quoting"><spanclass="std std-ref">How to quote and unquote commands and arguments</span></a></dt><dd><p>How to quote and unquote commands and arguments</p>
<dt><aclass="reference internal"href="api_facts_module.html#ansible-collections-community-routeros-api-facts-module"><spanclass="std std-ref">community.routeros.api_facts</span></a></dt><dd><p>Collect facts from remote devices running MikroTik RouterOS using the API.</p>
<dt><aclass="reference internal"href="api_find_and_modify_module.html#ansible-collections-community-routeros-api-find-and-modify-module"><spanclass="std std-ref">community.routeros.api_find_and_modify</span></a></dt><dd><p>Find and modify information using the API.</p>
<dt><aclass="reference internal"href="api_info_module.html#ansible-collections-community-routeros-api-info-module"><spanclass="std std-ref">community.routeros.api_info</span></a></dt><dd><p>Retrieve information from API.</p>
<dt><aclass="reference internal"href="api_modify_module.html#ansible-collections-community-routeros-api-modify-module"><spanclass="std std-ref">community.routeros.api_modify</span></a></dt><dd><p>Modify data at paths with API.</p>
<dt><aclass="reference internal"href="docsite/api-guide.html#ansible-collections-community-routeros-docsite-api-guide"><spanclass="std std-ref">How to connect to RouterOS devices with the RouterOS API</span></a></dt><dd><p>How to connect to RouterOS devices with the RouterOS API</p>
</dd>
</dl>
</div>
</section>
<sectionid="examples">
<h2><aclass="toc-backref"href="#id7">Examples</a><aclass="headerlink"href="#examples"title="Permalink 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">Get example - ip address print</span><spanclass="w"></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">Add example - ip address</span><spanclass="w"></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">Query example - ".id, address" in "ip address WHERE address == 192.168.255.10/24"</span><spanclass="w"></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">Extended query example - ".id,address,network" where address is not 192.168.255.10/24 or is 10.20.36.20/24</span><spanclass="w"></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">Update example - ether2 ip addres with ".id = *14"</span><spanclass="w"></span>
<spanclass="w"></span><spanclass="no">comment=</span><spanclass="cp">{{</span><spanclass="s1">'Update 192.168.255.10/24 to 192.168.255.20/24 on ether2'</span><spanclass="o">|</span><spanclass="nf">community</span><spanclass="nv">.routeros.quote_argument_value</span><spanclass="cp">}}</span><spanclass="w"></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">Remove example - ether2 ip 192.168.255.20/24 with ".id = *14"</span><spanclass="w"></span>
<h2><aclass="toc-backref"href="#id8">Return Values</a><aclass="headerlink"href="#return-values"title="Permalink to this heading"></a></h2>
<p>Common return values are documented <aclass="reference external"href="https://docs.ansible.com/ansible/devel/reference_appendices/common_return_values.html#common-return-values"title="(in Ansible vdevel)"><spanclass="xref std std-ref">here</span></a>, the following are the fields unique to this module:</p>
<aclass="ansibleOptionLink"href="#return-message"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 outputs are in list with dictionary elements returned from RouterOS api.</p>
<ahref="https://github.com/ansible-collections/community.routeros/issues/new?assignees=&labels=&template=bug_report.md"aria-role="button"target="_blank"rel="noopener external">Submit a bug report</a>
<ahref="https://github.com/ansible-collections/community.routeros/issues/new?assignees=&labels=&template=feature_request.md"aria-role="button"target="_blank"rel="noopener external">Request a feature</a>
<ahref="docsite/quoting.html"class="btn btn-neutral float-left"title="How to quote and unquote commands and arguments"accesskey="p"rel="prev"><spanclass="fa fa-arrow-circle-left"aria-hidden="true"></span> Previous</a>