DOCS: Network Best Practices fixes (#38293) (#38360)

* fixes typo per #38217, corrects link anchor

* adds ssh-agent info per #35649

(cherry picked from commit 24fe8674a6)
pull/38423/head
Alicia Cozine 7 years ago committed by John R Barker
parent f10b82c0d3
commit 222c1f1090

@ -1,4 +1,4 @@
.. network-best-practices: .. _network-best-practices:
************************************** **************************************
Network Best Practices for Ansible 2.5 Network Best Practices for Ansible 2.5
@ -55,7 +55,7 @@ An ``inventory`` file is an INI-like configuration file that defines the mapping
In our example, the inventory file defines the groups ``eos``, ``ios``, ``vyos`` and a "group of groups" called ``switches``. Further details about subgroups and inventory files can be found in the :ref:`Ansible inventory Group documentation <subgroups>`. In our example, the inventory file defines the groups ``eos``, ``ios``, ``vyos`` and a "group of groups" called ``switches``. Further details about subgroups and inventory files can be found in the :ref:`Ansible inventory Group documentation <subgroups>`.
Because Ansible is a flexible tool, there are a number of ways to specify connection information and credentials. We recommend using the ``[my_group:vars]`` capability in your inventory file: Because Ansible is a flexible tool, there are a number of ways to specify connection information and credentials. We recommend using the ``[my_group:vars]`` capability in your inventory file. Here's what it would look like if you specified your ssh passwords (encrypted with Ansible Vault) among your variables:
.. code-block:: ini .. code-block:: ini
@ -122,6 +122,8 @@ Because Ansible is a flexible tool, there are a number of ways to specify connec
3665626431626532630a353564323566316162613432373738333064366130303637616239396438 3665626431626532630a353564323566316162613432373738333064366130303637616239396438
9853 9853
If you use ssh-agent, you do not need the ``ansible_ssh_pass`` lines. If you use ssh keys, but not ssh-agent, and you have multiple keys, specify the key to use for each connection in the ``[group:vars]`` section with ``ansible_ssh_private_key_file=/path/to/correct/key``. For more information on ``ansible_ssh_`` options see the :ref:`behavioral_parameters`.
.. FIXME FUTURE Gundalow - Link to network auth & proxy page (to be written) .. FIXME FUTURE Gundalow - Link to network auth & proxy page (to be written)
.. warning:: Never store passwords in plain text. .. warning:: Never store passwords in plain text.
@ -247,7 +249,7 @@ Next, create a playbook file called ``facts-demo.yml`` containing the following:
#jinja2: lstrip_blocks: True #jinja2: lstrip_blocks: True
EOS device info: EOS device info:
{% for host in groups['eos'] %} {% for host in groups['eos'] %}
Hostname: {{ hostvars[host].ansible_net_version }} Hostname: {{ hostvars[host].ansible_net_hostname }}
Version: {{ hostvars[host].ansible_net_version }} Version: {{ hostvars[host].ansible_net_version }}
Model: {{ hostvars[host].ansible_net_model }} Model: {{ hostvars[host].ansible_net_model }}
Serial: {{ hostvars[host].ansible_net_serialnum }} Serial: {{ hostvars[host].ansible_net_serialnum }}
@ -255,7 +257,7 @@ Next, create a playbook file called ``facts-demo.yml`` containing the following:
IOS device info: IOS device info:
{% for host in groups['ios'] %} {% for host in groups['ios'] %}
Hostname: {{ hostvars[host].ansible_net_version }} Hostname: {{ hostvars[host].ansible_net_hostname }}
Version: {{ hostvars[host].ansible_net_version }} Version: {{ hostvars[host].ansible_net_version }}
Model: {{ hostvars[host].ansible_net_model }} Model: {{ hostvars[host].ansible_net_model }}
Serial: {{ hostvars[host].ansible_net_serialnum }} Serial: {{ hostvars[host].ansible_net_serialnum }}
@ -263,7 +265,7 @@ Next, create a playbook file called ``facts-demo.yml`` containing the following:
VyOS device info: VyOS device info:
{% for host in groups['vyos'] %} {% for host in groups['vyos'] %}
Hostname: {{ hostvars[host].ansible_net_version }} Hostname: {{ hostvars[host].ansible_net_hostname }}
Version: {{ hostvars[host].ansible_net_version }} Version: {{ hostvars[host].ansible_net_version }}
Model: {{ hostvars[host].ansible_net_model }} Model: {{ hostvars[host].ansible_net_model }}
Serial: {{ hostvars[host].ansible_net_serialnum }} Serial: {{ hostvars[host].ansible_net_serialnum }}

Loading…
Cancel
Save