<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: When is ansible useful? for network engineer in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4707487#M862</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/317909"&gt;@Tagir Temirgaliyev&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I may or may not try out your Ansible script, but I am definitely going to follow-up by building some pyATS automation using the ideas you've laid out in your post above.&amp;nbsp; I also plan to add a few twists, based upon my network environment, as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Collect &lt;EM&gt;&lt;STRONG&gt;show mac address-table&lt;/STRONG&gt;&lt;/EM&gt; information from all Nexus switches in the network&lt;/LI&gt;&lt;LI&gt;Collect&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;show arp&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;and&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;show arp vrf all&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;information from all ASR9K routers in the network&lt;/LI&gt;&lt;LI&gt;Store the information in two files, one for the output from the switches and one for the&lt;BR /&gt;output from the routers, so that it can be queried later&lt;/LI&gt;&lt;LI&gt;Develop a BASH / AWK script, using the one you've provided above as a base, to search the two files: using an IP address as input and returning information that includes IP address, router and router interface where the IP address was seen, MAC address for the IP address, and all switch and switch port information where the MAC address was seen&lt;/LI&gt;&lt;LI&gt;Develop a BASH / AWK script, leveraging the one above, to search the two files: using a MAC address&amp;nbsp;as input and returning information that includes MAC address, all switch and switch port information where the MAC address was seen, plus the router, router interface, and IP address where the MAC address was found, if possible&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I'll start the project by:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Manually gathering the ARP cache information from a single router&lt;/LI&gt;&lt;LI&gt;Picking out an IP address from the ARP cache information&lt;/LI&gt;&lt;LI&gt;Manually gathering information and determining which switches have the MAC address in their mac address table&lt;/LI&gt;&lt;LI&gt;Developing the script to match the IP address to the MAC address and associated switch ports to expand upon what you've done above&lt;/LI&gt;&lt;LI&gt;Developing the script to match the MAC address and track it back to the IP address, router, and router interface&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Once I'm confident the BASH / AWK scripts will work, I'll need to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Work out the details for using pyATS to collect all the router information&lt;/LI&gt;&lt;LI&gt;Work out the details for using pyATS to collect all the switch information&lt;/LI&gt;&lt;LI&gt;Determine a centralized location where I can store the router and switch information&lt;/LI&gt;&lt;LI&gt;Build a web page to use the two scripts along with all the data for troubleshooting&lt;/LI&gt;&lt;LI&gt;I'll also plan to archive the data each time the pyATS automation is run to help track changes in the network&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks for your post!!&lt;/P&gt;&lt;P&gt;It may take awhile, but hopefully your post will lead to a great troubleshooting tool for my network!!&lt;/P&gt;&lt;P&gt;@ittybittypacket&lt;/P&gt;&lt;P&gt;fjm / vrs&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2022 19:56:20 GMT</pubDate>
    <dc:creator>fracjackmac</dc:creator>
    <dc:date>2022-10-21T19:56:20Z</dc:date>
    <item>
      <title>When is ansible useful? for network engineer</title>
      <link>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4294963#M860</link>
      <description>&lt;P&gt;When is ansible useful? for network engineer&lt;/P&gt;
&lt;P&gt;1. You know the server name - how to find the MAC address and port of the switch in one click&lt;BR /&gt;2. Add a new Vlan to a switch group in one click&lt;BR /&gt;3. Add a new Vlan to a group of ports in one click&lt;/P&gt;
&lt;P&gt;1. You know the name of the server - how to find the MAC address and port of the switch in one click&lt;BR /&gt;this problem and solution has already been described by Hank Preston &lt;A href="https://blogs.cisco.com/developer/ask-hank-how-can-i-automate-a-mac-address-interface-report" target="_blank" rel="noopener"&gt;https://blogs.cisco.com/developer/ask-hank-how-can-i-automate-a-mac-address-interface-report&lt;/A&gt;&lt;BR /&gt;his solution relies on Cisco pyATS and my opinion is slightly complex. I suggest a little easier.&lt;BR /&gt;first, you need to create a folder with files containing the result of the show arp and show mac address-table commands. the file name must match the device name (these are all L2 and L3 switches)&lt;BR /&gt;further, if we work in Windows, we will have to use the dos window and findstr command twice, the first time to find the IP address and the second time to find the mac address. in linux you can in one click grep inside another grep and at the output we will get the name of the switch and the port number.&lt;/P&gt;
&lt;P&gt;how to create a folder? there are many methods like bash python ansible&lt;BR /&gt;if there is interest, then I will continue this topic in detail. please express your opinions&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 17:32:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4294963#M860</guid>
      <dc:creator>Tagir Temirgaliyev</dc:creator>
      <dc:date>2023-05-08T17:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: When is ansible useful? for network engineer</title>
      <link>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4300196#M861</link>
      <description>&lt;P&gt;here is example ansible playbook to create sh arp and sh mac address table files:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;---&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;-&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;name: Backup Configs&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;hosts: all&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;gather_facts: no&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;tasks:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;- name: Generate Backup Configs&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;cisco.ios.ios_config:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;backup: yes&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;backup_options:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;dir_path: ./config/&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;filename: "{{inventory_hostname}}.config"&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;- name: sh arp&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;ios_command:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;commands: show arp&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;register: output&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;- name: output&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;debug:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;var: output.stdout&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;- name: copy to file&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;copy: content="{{ output.stdout[0] }}" dest=./arp/{{ inventory_hostname }}.txt&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;- name: sh mac-add&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;ios_command:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;commands: show mac add&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;register: output&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;- name: output&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;debug:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;var: output.stdout&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;- name: copy to file&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;copy: content="{{ output.stdout[0] }}" dest=./mac/{{ inventory_hostname }}.txt&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;===========&lt;/P&gt;&lt;P&gt;here is example bash script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;tagir@ubuntu:~$ more sh_arp-mac.bash&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;#!/usr/bin/bash&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;##&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;##&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;##&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;newstr=`grep -H $1 ./arp/*`&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;echo $newstr&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;newfac=$(echo $newstr | awk '{ print $4 }')&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;echo $newfac&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;grep -H $newfac ./mac/*&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;A href="mailto:tagir@ubuntu:~$" target="_blank"&gt;tagir@ubuntu:~$&lt;/A&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is result of bash script:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bash.png" style="width: 400px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/105444i151A91A6743E5201/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bash.png" alt="bash.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 18:43:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4300196#M861</guid>
      <dc:creator>Tagir Temirgaliyev</dc:creator>
      <dc:date>2021-03-02T18:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: When is ansible useful? for network engineer</title>
      <link>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4707487#M862</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/317909"&gt;@Tagir Temirgaliyev&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I may or may not try out your Ansible script, but I am definitely going to follow-up by building some pyATS automation using the ideas you've laid out in your post above.&amp;nbsp; I also plan to add a few twists, based upon my network environment, as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Collect &lt;EM&gt;&lt;STRONG&gt;show mac address-table&lt;/STRONG&gt;&lt;/EM&gt; information from all Nexus switches in the network&lt;/LI&gt;&lt;LI&gt;Collect&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;show arp&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;and&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;show arp vrf all&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;information from all ASR9K routers in the network&lt;/LI&gt;&lt;LI&gt;Store the information in two files, one for the output from the switches and one for the&lt;BR /&gt;output from the routers, so that it can be queried later&lt;/LI&gt;&lt;LI&gt;Develop a BASH / AWK script, using the one you've provided above as a base, to search the two files: using an IP address as input and returning information that includes IP address, router and router interface where the IP address was seen, MAC address for the IP address, and all switch and switch port information where the MAC address was seen&lt;/LI&gt;&lt;LI&gt;Develop a BASH / AWK script, leveraging the one above, to search the two files: using a MAC address&amp;nbsp;as input and returning information that includes MAC address, all switch and switch port information where the MAC address was seen, plus the router, router interface, and IP address where the MAC address was found, if possible&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I'll start the project by:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Manually gathering the ARP cache information from a single router&lt;/LI&gt;&lt;LI&gt;Picking out an IP address from the ARP cache information&lt;/LI&gt;&lt;LI&gt;Manually gathering information and determining which switches have the MAC address in their mac address table&lt;/LI&gt;&lt;LI&gt;Developing the script to match the IP address to the MAC address and associated switch ports to expand upon what you've done above&lt;/LI&gt;&lt;LI&gt;Developing the script to match the MAC address and track it back to the IP address, router, and router interface&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Once I'm confident the BASH / AWK scripts will work, I'll need to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Work out the details for using pyATS to collect all the router information&lt;/LI&gt;&lt;LI&gt;Work out the details for using pyATS to collect all the switch information&lt;/LI&gt;&lt;LI&gt;Determine a centralized location where I can store the router and switch information&lt;/LI&gt;&lt;LI&gt;Build a web page to use the two scripts along with all the data for troubleshooting&lt;/LI&gt;&lt;LI&gt;I'll also plan to archive the data each time the pyATS automation is run to help track changes in the network&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks for your post!!&lt;/P&gt;&lt;P&gt;It may take awhile, but hopefully your post will lead to a great troubleshooting tool for my network!!&lt;/P&gt;&lt;P&gt;@ittybittypacket&lt;/P&gt;&lt;P&gt;fjm / vrs&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 19:56:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4707487#M862</guid>
      <dc:creator>fracjackmac</dc:creator>
      <dc:date>2022-10-21T19:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: When is ansible useful? for network engineer</title>
      <link>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4716586#M863</link>
      <description>&lt;P&gt;&lt;SPAN&gt;How to add a new Vlans to a group of ports in one click using ansible and keep&amp;nbsp;configuration consistency&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for demonstration purpose, I created a simplified topology with 2 switches and 4 servers.&lt;BR /&gt;two servers belong to cluster A, and two more servers belong to cluster B. All ports trunk.&lt;BR /&gt;Of course, in reality, we meet with a much more complex topology where there can be up to 100 or more servers and up to 100 or more switches.&lt;BR /&gt;in a real production environment, tasks appear to add or remove one or more vlans to cluster A or cluster B, or to add or remove one or more servers to cluster and you have to add vlan manually to hundreds of ports.&lt;BR /&gt;in reality, configuration consistency is very important.&lt;BR /&gt;using ansible, you can add new vlan (or remove) to the list of vlans in the cluster in only one place.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 958px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/167192i111AB20A506DD28F/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/167193i0254D85D4A774814/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is a simple ansible playbook screenshot&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ansible_playbook screen.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/167194iBF51B794018A3B67/image-size/large?v=v2&amp;amp;px=999" role="button" title="ansible_playbook screen.png" alt="ansible_playbook screen.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ansible_report.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/167195iFD768A11CCF6CB45/image-size/large?v=v2&amp;amp;px=999" role="button" title="ansible_report.png" alt="ansible_report.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here switches before adding vlans&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="switch_config_before_ansible.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/167196iB3588D7F583F00F6/image-size/large?v=v2&amp;amp;px=999" role="button" title="switch_config_before_ansible.png" alt="switch_config_before_ansible.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;switches after adding vlans&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="switch_config_after_ansible.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/167197i31A160E1852FFA63/image-size/large?v=v2&amp;amp;px=999" role="button" title="switch_config_after_ansible.png" alt="switch_config_after_ansible.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 20:14:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/when-is-ansible-useful-for-network-engineer/m-p/4716586#M863</guid>
      <dc:creator>Tagir Temirgaliyev</dc:creator>
      <dc:date>2022-11-05T20:14:24Z</dc:date>
    </item>
  </channel>
</rss>

