Networking/Computing Tips/Tricks

Rate this content:
5 of 5 - 1 votes
Thank you for rating this article.

Ansible is a tool used to automate Server provisioning and network provisioning.  Ansible is completely free!  You can dive deep into Ansible at their web site.

A great way to learn Ansible as a network automation tool is to use it in an emulated network environment. GNS3 fits that requirement perfectly.  GNS3 is also completely free!

As many of you know, we have been users of GNS3 since forever, plus we were part of their crowd sourcing!

GNS3 has evolved tremendously in the past years. Using the versions after 2.x brings great functionality into GNS3 including Ansible. We strongly urge students to use GNS3 to learn Ansible. If you want to learn how to install and use GNS3, there is a separate reference here.  Assuming you have version 2.x or later of GNS3 running, we will show how to accomplish this in a couple of simple videos below.

Even if you have never used GNS3, you can watch the videos below to get a clear understanding of how Ansible works!

Watch this video first to see exactly how to get Ansible with your GNS3 environment.

Install Ansible in GNS3 from Andrew Walding on Vimeo.

 The next step is to configure IP addresses:

 

 

 Here is the router configuration used:

enable
configure terminal
hostname R1
alias exec s show run
alias exec c config terminal
alias exec i show ip interface brief
alias exec ipr show ip route
ip tcp synwait 5
no service timestamps
no service time debug
line console 0
no login
no exec-timeout
logging synch
privilege level 15
line aux 0
no login
no exec-timeout
logging synch
privilege level 15
line vty 0 4
login local
transport input all
ip domain-name cellstream.com
crypto key generate rsa
1024
interface f0/0
ip address 192.168.1.101 255.255.255.0
no shutdown
username student pass csi123
username student priv 15
end
write

Now let's add some routers into the topology:

 

 Now it is time to set up a simple Ansible environment. We will create a simple ansible.cfg file and a hosts file so ansible will be able to work with our routers:

 

 It's finally time to actually create an Ansible playbook and run it against our topology. You will find the playbook1.yml file available to download below the video.

 

 Here is the playbook1.yml content:

---
- name: Install OSPF
  hosts: [gns3routers]
  gather_facts: false
  connection: local

  vars:
    cli:
      username: student
      password: csi123
      transport: cli

  tasks:
    - name: enable ospf
      ios_config:
        provider: "{{ cli }}"
        authorize: yes
        parents: router ospf 1
        lines:
          - network 0.0.0.0 255.255.255.255 area 0

      register: print_output

    - debug: var=print_output

 

I hope you find this article and its content helpful.  Comments are welcomed below.  If you would like to see more articles like this, please support us by clicking the patron link where you will receive free bonus access to courses and more, or simply buying us a cup of coffee!, and all comments are welcome! 

Add comment

Submit

Did you learn something?
Did I save you time? 

Buy me a coffeeBuy me a coffee!

Find by Tag

5G Networks 6LoWLAN 6LoWPAN 802.11 802.11ah 802.11ax 802.11ay 802.11az ACL Addressing Analysis Ansible Architecture ARP Assessment AToM Backup Bandwidth BGP Bibliography Biography Briefings CBRS CellStream Cellular Central Office Cheat Sheet Chrome Cisco Clock Cloud Computer Consulting CPI Data Center Data Networking Decryption DHCPv4 DHCPv6 Display Filter DNS Documentation ECMP EIGRP Ethernet Flipping the Certification Model Follow Me Fragmentation Git GNS3 Google GQUIC Hands-On History Home Network HTTPS ICMP ICMPv6 IEEE 802.11p IEEE 802.15.4 In A Day Internet IOS Classic IoT IPv4 IPv6 L2 Switch L2VPN L3VPN LDP Learning Services Linux LLN Logging LoL M-BGP MAC MAC OSx Macro Microsoft mininet Monitoring Monitor Mode MPLS Multicast Name Resolution Netflow NetMon netsh Networking Network Science nmap Npcap nslookup Online Learning Online School OpenFlow OSPF OSPFv2 OSPFv3 OSX Parrot Passwords pcap pcap-ng PIM Ping Policy Port Mirror POTS POTS to Pipes PPP Profile Profiles Programming Project Management Python QoS QUIC Requirements RFC RIP Routing RPL RSVP SAS SDN Security Self Certification Service Provider Small Business Smartport SONET Span Port SSH SSL Subnetting T-Shark TCP TCP/IP Telco Telecom 101 Telecommunications Telnet Terminal TLS Tools Traceroute Traffic Analysis Traffic Engineering Training Travel Troubleshooting Tunnel Utility Video Virtualbox Virtualization Voice VoIP VXLAN Webex Wi-Fi Wi-Fi 4 Wi-Fi 5 Wi-Fi 6 Wi-Fi 6/6E Windows Wireless Wireless 5G Wireshark Wireshark Tip WLAN ZigBee Zoom

Twitter Feed