Skip to content

Commit

Permalink
update Ansible-maintained platform guides with FQCN (ansible#70369)
Browse files Browse the repository at this point in the history
* update platform guides with FQCN
* implemented feedback
* fix remainin fqcn
* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
  • Loading branch information
samccann committed Aug 10, 2020
1 parent ae12910 commit 172230d
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 173 deletions.
92 changes: 24 additions & 68 deletions docs/docsite/rst/network/user_guide/platform_eos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
EOS Platform Options
***************************************

Arista EOS supports multiple connections. This page offers details on how each connection works in Ansible and how to use it.
The `Arista EOS <https://galaxy.ansible.com/arista/eos>`_ collection supports multiple connections. This page offers details on how each connection works in Ansible and how to use it.

.. contents:: Topics
.. contents::
:local:

Connections Available
Connections available
================================================================================

.. table::
:class: documentation-table

==================== ========================================== =========================
==================== ========================================== ===========================
.. CLI eAPI
==================== ========================================== =========================
==================== ========================================== ===========================
Protocol SSH HTTP(S)

Credentials uses SSH keys / SSH-agent if present uses HTTPS certificates if
Expand All @@ -25,32 +26,23 @@ Connections Available

Indirect Access via a bastion (jump host) via a web proxy

Connection Settings ``ansible_connection: network_cli`` ``ansible_connection: httpapi``
Connection Settings ``ansible_connection:`` ``ansible_connection:``
``ansible.netcommon.network_cli`` ``ansible.netcommon.httpapi``

OR

``ansible_connection: local``
with ``transport: eapi``
in the ``provider`` dictionary

|enable_mode| supported: |br| supported: |br|

* use ``ansible_become: yes`` * ``httpapi``
with ``ansible_become_method: enable`` uses ``ansible_become: yes``
with ``ansible_become_method: enable``

* ``local``
uses ``authorize: yes``
and ``auth_pass:``
in the ``provider`` dictionary

Returned Data Format ``stdout[0].`` ``stdout[0].messages[0].``
==================== ========================================== =========================
==================== ========================================== ===========================

.. |enable_mode| replace:: Enable Mode |br| (Privilege Escalation)


For legacy playbooks, EOS still supports ``ansible_connection: local``. We recommend modernizing to use ``ansible_connection: network_cli`` or ``ansible_connection: httpapi`` as soon as possible.
The ``ansible_connection: local`` has been deprecated. Please use ``ansible_connection: ansible.netcommon.network_cli`` or ``ansible_connection: ansible.netcommon.httpapi`` instead.

Using CLI in Ansible
====================
Expand All @@ -60,8 +52,8 @@ Example CLI ``group_vars/eos.yml``

.. code-block:: yaml

ansible_connection: network_cli
ansible_network_os: eos
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: arista.eos.eos
ansible_user: myuser
ansible_password: !vault...
ansible_become: yes
Expand All @@ -74,16 +66,16 @@ Example CLI ``group_vars/eos.yml``
- If you are accessing your host directly (not through a bastion/jump host) you can remove the ``ansible_ssh_common_args`` configuration.
- If you are accessing your host through a bastion/jump host, you cannot include your SSH password in the ``ProxyCommand`` directive. To prevent secrets from leaking out (for example in ``ps`` output), SSH does not support providing passwords via environment variables.

Example CLI Task
Example CLI task
----------------

.. code-block:: yaml

- name: Backup current switch config (eos)
eos_config:
arista.eos.eos_config:
backup: yes
register: backup_eos_location
when: ansible_network_os == 'eos'
when: ansible_network_os == 'arista.eos.eos'



Expand All @@ -93,19 +85,19 @@ Using eAPI in Ansible
Enabling eAPI
-------------

Before you can use eAPI to connect to a switch, you must enable eAPI. To enable eAPI on a new switch via Ansible, use the ``eos_eapi`` module via the CLI connection. Set up group_vars/eos.yml just like in the CLI example above, then run a playbook task like this:
Before you can use eAPI to connect to a switch, you must enable eAPI. To enable eAPI on a new switch with Ansible, use the ``arista.eos.eos_eapi`` module through the CLI connection. Set up ``group_vars/eos.yml`` just like in the CLI example above, then run a playbook task like this:

.. code-block:: yaml

- name: Enable eAPI
eos_eapi:
arista.eos.eos_eapi:
enable_http: yes
enable_https: yes
become: true
become_method: enable
when: ansible_network_os == 'eos'
when: ansible_network_os == 'arista.eos.eos'

You can find more options for enabling HTTP/HTTPS connections in the :ref:`eos_eapi <eos_eapi_module>` module documentation.
You can find more options for enabling HTTP/HTTPS connections in the :ref:`arista.eos.eos_eapi <ansible_collections.arista.eos.eos_eapi_module>` module documentation.

Once eAPI is enabled, change your ``group_vars/eos.yml`` to use the eAPI connection.

Expand All @@ -114,8 +106,8 @@ Example eAPI ``group_vars/eos.yml``

.. code-block:: yaml

ansible_connection: httpapi
ansible_network_os: eos
ansible_connection: ansible.netcommon.httpapi
ansible_network_os: arista.eos.eos
ansible_user: myuser
ansible_password: !vault...
ansible_become: yes
Expand All @@ -127,56 +119,20 @@ Example eAPI ``group_vars/eos.yml``
- If you are accessing your host through a web proxy using ``https``, change ``http_proxy`` to ``https_proxy``.


Example eAPI Task
Example eAPI task
-----------------

.. code-block:: yaml

- name: Backup current switch config (eos)
eos_config:
arista.eos.eos_config:
backup: yes
register: backup_eos_location
environment: "{{ proxy_env }}"
when: ansible_network_os == 'eos'
when: ansible_network_os == 'arista.eos.eos'

In this example the ``proxy_env`` variable defined in ``group_vars`` gets passed to the ``environment`` option of the module in the task.

eAPI examples with ``connection: local``
-----------------------------------------

``group_vars/eos.yml``:

.. code-block:: yaml

ansible_connection: local
ansible_network_os: eos
ansible_user: myuser
ansible_password: !vault...
eapi:
host: "{{ inventory_hostname }}"
transport: eapi
authorize: yes
auth_pass: !vault...
proxy_env:
http_proxy: http://proxy.example.com:8080

eAPI task:

.. code-block:: yaml

- name: Backup current switch config (eos)
eos_config:
backup: yes
provider: "{{ eapi }}"
register: backup_eos_location
environment: "{{ proxy_env }}"
when: ansible_network_os == 'eos'

In this example two variables defined in ``group_vars`` get passed to the module of the task:

- the ``eapi`` variable gets passed to the ``provider`` option of the module
- the ``proxy_env`` variable gets passed to the ``environment`` option of the module

.. include:: shared_snippets/SSH_warning.txt

.. seealso::
Expand Down
19 changes: 10 additions & 9 deletions docs/docsite/rst/network/user_guide/platform_frr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
FRR Platform Options
***************************************

This page offers details on connection options to manage FRR using Ansible.
The `FRR <https://galaxy.ansible.com/frr/frr>`_ collection supports the ``ansible.netcommon.network_cli`` connection. This section provides details on how to use this connection for Free Range Routing (FRR).

.. contents:: Topics
.. contents::
:local:

Connections Available
Connections available
================================================================================

.. table::
Expand All @@ -25,7 +26,7 @@ Connections Available

Indirect Access via a bastion (jump host)

Connection Settings ``ansible_connection: network_cli``
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``

|enable_mode| not supported

Expand All @@ -43,24 +44,24 @@ Example CLI ``group_vars/frr.yml``

.. code-block:: yaml

ansible_connection: network_cli
ansible_network_os: frr
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: frr.frr.frr
ansible_user: frruser
ansible_password: !vault...
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'

- The `ansible_user` should be a part of the `frrvty` group and should have the default shell set to `/bin/vtysh`.
- The ``ansible_user`` should be a part of the ``frrvty`` group and should have the default shell set to ``/bin/vtysh``.
- If you are using SSH keys (including an ssh-agent) you can remove the ``ansible_password`` configuration.
- If you are accessing your host directly (not through a bastion/jump host) you can remove the ``ansible_ssh_common_args`` configuration.
- If you are accessing your host through a bastion/jump host, you cannot include your SSH password in the ``ProxyCommand`` directive. To prevent secrets from leaking out (for example in ``ps`` output), SSH does not support providing passwords via environment variables.

Example CLI Task
Example CLI task
----------------

.. code-block:: yaml

- name: Gather FRR facts
frr_facts:
frr.frr.frr_facts:
gather_subset:
- config
- hardware
Expand Down
21 changes: 11 additions & 10 deletions docs/docsite/rst/network/user_guide/platform_ios.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
IOS Platform Options
***************************************

IOS supports Enable Mode (Privilege Escalation). This page offers details on how to use Enable Mode on IOS in Ansible.
The `Cisco IOS <https://galaxy.ansible.com/cisco/ios>`_ collection supports Enable Mode (Privilege Escalation). This page offers details on how to use Enable Mode on IOS in Ansible.

.. contents:: Topics
.. contents::
:local:

Connections Available
Connections available
================================================================================

.. table::
Expand All @@ -25,7 +26,7 @@ Connections Available

Indirect Access via a bastion (jump host)

Connection Settings ``ansible_connection: network_cli``
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``

|enable_mode| supported: use ``ansible_become: yes`` with
``ansible_become_method: enable`` and ``ansible_become_password:``
Expand All @@ -36,7 +37,7 @@ Connections Available
.. |enable_mode| replace:: Enable Mode |br| (Privilege Escalation)


For legacy playbooks, IOS still supports ``ansible_connection: local``. We recommend modernizing to use ``ansible_connection: network_cli`` as soon as possible.
The ``ansible_connection: local`` has been deprecated. Please use ``ansible_connection: ansible.netcommon.network_cli`` instead.

Using CLI in Ansible
====================
Expand All @@ -46,8 +47,8 @@ Example CLI ``group_vars/ios.yml``

.. code-block:: yaml

ansible_connection: network_cli
ansible_network_os: ios
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: cisco.ios.ios
ansible_user: myuser
ansible_password: !vault...
ansible_become: yes
Expand All @@ -60,16 +61,16 @@ Example CLI ``group_vars/ios.yml``
- If you are accessing your host directly (not through a bastion/jump host) you can remove the ``ansible_ssh_common_args`` configuration.
- If you are accessing your host through a bastion/jump host, you cannot include your SSH password in the ``ProxyCommand`` directive. To prevent secrets from leaking out (for example in ``ps`` output), SSH does not support providing passwords via environment variables.

Example CLI Task
Example CLI task
----------------

.. code-block:: yaml

- name: Backup current switch config (ios)
ios_config:
cisco.ios.ios_config:
backup: yes
register: backup_ios_location
when: ansible_network_os == 'ios'
when: ansible_network_os == 'cisco.ios.ios'

.. include:: shared_snippets/SSH_warning.txt

Expand Down

0 comments on commit 172230d

Please sign in to comment.