Skip to content

Ansible role for testing open network ports and collecting hardware and interface facts on network devices

License

Notifications You must be signed in to change notification settings

dbono711/ansible-network-facts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Role: Ansible network facts collection

Ansible role for testing open network ports and collecting hardware and interface facts on network devices

Overview

This role tests for open network ports (TELNET, SSH, NETCONF) on target hosts and collects facts about device hardware and interfaces using the respective network operating systems' *_facts modules (i.e., ios_facts) with custom templating

By default, the output is stored in the output/ansible_network_facts folder that is automatically created at the root from where you are executing the corresponding playbook. If you also want to send an e-mail of the output, ensure that send_email is true and provide the necessary mail credentials in defaults/main.yml. All variables that can be overridden can be found under Role Variables.

Prerequisites

Supported Network Operating Systems

Port Checking

A custom Ansible module - network_port_check.py - is used for running the check for the open ports.

Role Variables

All variables which can be overridden are stored within defaults/main.yml

Name Default Description

Sample Inventory

Network Host Sample Inventory

Sample Playbook

---
- name: Assemble facts for network devices
  hosts: all
  gather_facts: false
  tasks:
    - name: Check for open ports and gather facts
      ansible.builtin.include_role:
        name: ansible-network-facts
      tags:
        - "always"

Sample Execution

Test for open ports and collect all facts

ansible-playbook [playbook name] -i [inventory location]

Test only for open ports

ansible-playbook [playbook name] -i [inventory location] --tags=ports

Test for open ports and collect hardware facts

ansible-playbook [playbook name] -i [inventory location] --tags=ports,hardware

Additional Resources

Ansible Network Automation

Authors

License

This project is licensed under the MIT License. See LICENSE for details

About

Ansible role for testing open network ports and collecting hardware and interface facts on network devices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published