447 lines
27 KiB
ReStructuredText
447 lines
27 KiB
ReStructuredText
.. Document meta
|
|
|
|
|
|
.. Anchors
|
|
|
|
.. _ansible_collections.dellemc.os10.os10_command_module:
|
|
|
|
.. Anchors: short name for ansible.builtin
|
|
|
|
.. Anchors: aliases
|
|
|
|
|
|
|
|
.. Title
|
|
|
|
dellemc.os10.os10_command -- Run commands on devices running Dell EMC SmartFabric OS10
|
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
.. Collection note
|
|
|
|
.. note::
|
|
This plugin is part of the `dellemc.os10 collection <https://galaxy.ansible.com/dellemc/os10>`_.
|
|
|
|
To install it use: :code:`ansible-galaxy collection install dellemc.os10`.
|
|
|
|
To use it in a playbook, specify: :code:`dellemc.os10.os10_command`.
|
|
|
|
.. version_added
|
|
|
|
|
|
.. contents::
|
|
:local:
|
|
:depth: 1
|
|
|
|
.. Deprecated
|
|
|
|
|
|
Synopsis
|
|
--------
|
|
|
|
.. Description
|
|
|
|
- Sends arbitrary commands to a OS10 device and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met.
|
|
- This module does not support running commands in configuration mode. Please use `dellemc.os10.os10_config <dellemc.os10.os10_config_module.rst>`_ to configure OS10 devices.
|
|
|
|
|
|
.. Aliases
|
|
|
|
|
|
.. Requirements
|
|
|
|
|
|
.. Options
|
|
|
|
Parameters
|
|
----------
|
|
|
|
.. raw:: html
|
|
|
|
<table border=0 cellpadding=0 class="documentation-table">
|
|
<tr>
|
|
<th colspan="2">Parameter</th>
|
|
<th>Choices/<font color="blue">Defaults</font></th>
|
|
<th width="100%">Comments</th>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="ansibleOptionAnchor" id="parameter-commands"></div>
|
|
<b>commands</b>
|
|
<a class="ansibleOptionLink" href="#parameter-commands" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">list</span>
|
|
/ <span style="color: purple">elements=string</span> / <span style="color: red">required</span> </div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>List of commands to send to the remote OS10 device over the configured provider. The resulting output from the command is returned. If the <em>wait_for</em> argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="ansibleOptionAnchor" id="parameter-interval"></div>
|
|
<b>interval</b>
|
|
<a class="ansibleOptionLink" href="#parameter-interval" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">integer</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<b>Default:</b><br/><div style="color: blue">1</div>
|
|
</td>
|
|
<td>
|
|
<div>Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="ansibleOptionAnchor" id="parameter-match"></div>
|
|
<b>match</b>
|
|
<a class="ansibleOptionLink" href="#parameter-match" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">string</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
|
<li><div style="color: blue"><b>all</b> ←</div></li>
|
|
<li>any</li>
|
|
</ul>
|
|
</td>
|
|
<td>
|
|
<div>The <em>match</em> argument is used in conjunction with the <em>wait_for</em> argument to specify the match policy. Valid values are <code>all</code> or <code>any</code>. If the value is set to <code>all</code> then all conditionals in the wait_for must be satisfied. If the value is set to <code>any</code> then only one of the values must be satisfied.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider"></div>
|
|
<b>provider</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">dictionary</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>A dict object containing connection details.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/auth_pass"></div>
|
|
<b>auth_pass</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/auth_pass" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">string</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>Specifies the password to use if required to enter privileged mode on the remote device. If <em>authorize</em> is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTH_PASS</code> will be used instead.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/authorize"></div>
|
|
<b>authorize</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/authorize" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">boolean</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
|
<li><div style="color: blue"><b>no</b> ←</div></li>
|
|
<li>yes</li>
|
|
</ul>
|
|
</td>
|
|
<td>
|
|
<div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/host"></div>
|
|
<b>host</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/host" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">string</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/password"></div>
|
|
<b>password</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/password" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">string</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_PASSWORD</code> will be used instead.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/port"></div>
|
|
<b>port</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/port" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">integer</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>Specifies the port to use when building the connection to the remote device.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/ssh_keyfile"></div>
|
|
<b>ssh_keyfile</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/ssh_keyfile" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">path</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_SSH_KEYFILE</code> will be used instead.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/timeout"></div>
|
|
<b>timeout</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/timeout" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">integer</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="elbow-placeholder"></td>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="parameter-provider/username"></div>
|
|
<b>username</b>
|
|
<a class="ansibleOptionLink" href="#parameter-provider/username" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">string</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_USERNAME</code> will be used instead.</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="ansibleOptionAnchor" id="parameter-retries"></div>
|
|
<b>retries</b>
|
|
<a class="ansibleOptionLink" href="#parameter-retries" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">integer</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<b>Default:</b><br/><div style="color: blue">10</div>
|
|
</td>
|
|
<td>
|
|
<div>Specifies the number of retries a command should be tried before it is considered failed. The command is run on the target device every retry and evaluated against the <em>wait_for</em> conditions.</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="ansibleOptionAnchor" id="parameter-wait_for"></div>
|
|
<b>wait_for</b>
|
|
<a class="ansibleOptionLink" href="#parameter-wait_for" title="Permalink to this option"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">list</span>
|
|
/ <span style="color: purple">elements=string</span> </div>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<div>List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of <em>retries</em>, the task fails. See examples.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br/>
|
|
|
|
.. Notes
|
|
|
|
Notes
|
|
-----
|
|
|
|
.. note::
|
|
- For more information on using Ansible to manage Dell EMC Network devices see https://www.ansible.com/ansible-dell-networking.
|
|
|
|
.. Seealso
|
|
|
|
|
|
.. Examples
|
|
|
|
Examples
|
|
--------
|
|
|
|
.. code-block:: yaml+jinja
|
|
|
|
|
|
tasks:
|
|
- name: run show version on remote devices
|
|
os10_command:
|
|
commands: show version
|
|
|
|
- name: run show version and check to see if output contains OS10
|
|
os10_command:
|
|
commands: show version
|
|
wait_for: result[0] contains OS10
|
|
|
|
- name: run multiple commands on remote nodes
|
|
os10_command:
|
|
commands:
|
|
- show version
|
|
- show interface
|
|
|
|
- name: run multiple commands and evaluate the output
|
|
os10_command:
|
|
commands:
|
|
- show version
|
|
- show interface
|
|
wait_for:
|
|
- result[0] contains OS10
|
|
- result[1] contains Ethernet
|
|
|
|
|
|
|
|
|
|
.. Facts
|
|
|
|
|
|
.. Return values
|
|
|
|
Return Values
|
|
-------------
|
|
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
|
|
|
.. raw:: html
|
|
|
|
<table border=0 cellpadding=0 class="documentation-table">
|
|
<tr>
|
|
<th colspan="1">Key</th>
|
|
<th>Returned</th>
|
|
<th width="100%">Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="return-failed_conditions"></div>
|
|
<b>failed_conditions</b>
|
|
<a class="ansibleOptionLink" href="#return-failed_conditions" title="Permalink to this return value"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">list</span>
|
|
/ <span style="color: purple">elements=string</span> </div>
|
|
</td>
|
|
<td>failed</td>
|
|
<td>
|
|
<div>The list of conditionals that have failed</div>
|
|
<br/>
|
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['...', '...']</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="return-stdout"></div>
|
|
<b>stdout</b>
|
|
<a class="ansibleOptionLink" href="#return-stdout" title="Permalink to this return value"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">list</span>
|
|
/ <span style="color: purple">elements=string</span> </div>
|
|
</td>
|
|
<td>always apart from low level errors (such as action plugin)</td>
|
|
<td>
|
|
<div>The set of responses from the commands</div>
|
|
<br/>
|
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['...', '...']</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="return-stdout_lines"></div>
|
|
<b>stdout_lines</b>
|
|
<a class="ansibleOptionLink" href="#return-stdout_lines" title="Permalink to this return value"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">list</span>
|
|
/ <span style="color: purple">elements=string</span> </div>
|
|
</td>
|
|
<td>always apart from low level errors (such as action plugin)</td>
|
|
<td>
|
|
<div>The value of stdout split into a list</div>
|
|
<br/>
|
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[['...', '...'], ['...'], ['...']]</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="1">
|
|
<div class="ansibleOptionAnchor" id="return-warnings"></div>
|
|
<b>warnings</b>
|
|
<a class="ansibleOptionLink" href="#return-warnings" title="Permalink to this return value"></a>
|
|
<div style="font-size: small">
|
|
<span style="color: purple">list</span>
|
|
/ <span style="color: purple">elements=string</span> </div>
|
|
</td>
|
|
<td>always</td>
|
|
<td>
|
|
<div>The list of warnings (if any) generated by module based on arguments</div>
|
|
<br/>
|
|
<div style="font-size: smaller"><b>Sample:</b></div>
|
|
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['...', '...']</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br/><br/>
|
|
|
|
.. Status (Presently only deprecated)
|
|
|
|
|
|
.. Authors
|
|
|
|
Authors
|
|
~~~~~~~
|
|
|
|
- Senthil Kumar Ganesan (@skg-net)
|
|
|
|
|
|
|
|
.. Parsing errors
|
|
|