clarify httpapi with an example (#65083)
This commit is contained in:
parent
b2fc12a29f
commit
7084dd727a
2 changed files with 26 additions and 2 deletions
|
@ -27,6 +27,9 @@ Because network modules execute on the control node instead of on the managed no
|
|||
"httpapi", "API over HTTP/HTTPS", "network_os setting", "yes"
|
||||
"local", "depends on provider", "provider setting", "no"
|
||||
|
||||
.. note::
|
||||
``httpapi`` deprecates ``eos_eapi`` and ``nxos_nxapi``. See :ref:`httpapi_plugins` for details and an example.
|
||||
|
||||
Beginning with Ansible 2.6, we recommend using one of the persistent connection types listed above instead of ``local``. With persistent connections, you can define the hosts and credentials only once, rather than in every task. For more details on using each connection type on various platforms, see the :ref:`platform-specific <platform_options>` pages.
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,27 @@ Most httpapi plugins can operate without configuration. Additional options may b
|
|||
Plugins are self-documenting. Each plugin should document its configuration options.
|
||||
|
||||
|
||||
The following sample playbook shows the httpapi plugin for an Arista network device, assuming an inventory variable set as ``ansible_network_os=eos`` for the httpapi plugin to trigger off:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- hosts: leaf01
|
||||
connection: httpapi
|
||||
gather_facts: false
|
||||
tasks:
|
||||
|
||||
- name: type a simple arista command
|
||||
eos_command:
|
||||
commands:
|
||||
- show version | json
|
||||
register: command_output
|
||||
|
||||
- name: print command output to terminal window
|
||||
debug:
|
||||
var: command_output.stdout[0]["version"]
|
||||
|
||||
See the full working example at https://github.com/network-automation/httpapi.
|
||||
|
||||
.. _httpapi_plugin_list:
|
||||
|
||||
Plugin List
|
||||
|
|
Loading…
Add table
Reference in a new issue