Discovery IPv4 Address with nmap and Ansible
Discovery IPv4 Address with nmap and Ansible
PNETLAB Store
PNETLab.com
1. Lab Topology
https://user.pnetlab.com/store/labs/detail?id=16011204105834
2. Requirements
Ansible.
Linux commands.
CCNA.
3. Lab Objective
This lab will show you how to create playbook discovery ip address of devices.
4.Lab setup
1
Download PNETLab Platform
PNETLAB Store
PNETLab.com
This lab use Ansible platform version 2.9.6, you can get it on devices mode in
PNETLab GUI:
You should reading guide before download and use this platforms:
https://user.pnetlab.com/store/devices/guide?id=4
5.Lab Guide
2
Download PNETLab Platform
PNETLAB Store
PNETLab.com
• Step 2: Create playbook discovery and collect ip address of devices that Ansible
workstation see.
o cd /etc/ansible/
o touch run.yml
o Edit playbook
o vim run.yml
o Playbook include below tasks:
▪ Collect data with nmap scan ip:
3
Download PNETLab Platform
PNETLAB Store
PNETLab.com
▪ Filter data:
4
Download PNETLab Platform
PNETLAB Store
PNETLab.com
o This’s result:
You can explain this lab on topology configured routing protocols or with other devices.
Finish this lab!
6. Solution:
Playbook:
---
- name: Discovery Host...
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Collecting data…..
shell: "nmap -sn -oG - {{ scan_net }}"
vars:
scan_net: 192.168.1.0/24
register: data_input
- set_fact:
5
Download PNETLab Platform
PNETLAB Store
PNETLab.com