-
The Ansible Network Reports Collection provides a platform-agnostic way to gather, generate, persist, and visualize network resource reports. This collection enables users to collect network facts, convert them into structured formats (YAML, JSON), and visualize them as HTML reports using Jinja2 templates.
-
This collection can be used by network administrators, system operators, and IT professionals looking to monitor and manage their network infrastructure through automated reporting.
- Requires Ansible
- Requires Content Collections
- Testing Requirements
- Users also need to include platform collections as per their requirements. The supported platform collections are:
To consume this Validated Content from Automation Hub, the following needs to be added to ansible.cfg
:
[galaxy]
server_list = automation_hub
[galaxy_server.automation_hub]
url=https://console.redhat.com/api/automation-hub/content/validated/
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
token=<SuperSecretToken>
Utilize the current Token, and if the token has expired, obtain the necessary token from the Automation Hub Web UI.
With this configured, simply run the following commands:
ansible-galaxy collection install network.base
ansible-galaxy collection install network.reports
- Collect network resource facts like interfaces, BGP configurations, OSPF settings, etc.
- Convert these facts into YAML, JSON, or HTML formats.
- name: Gather Network Reports
hosts: network_devices
gather_facts: false
tasks:
- name: Network Resource Manager
ansible.builtin.include_role:
name: network.reports.gather
vars:
format:
- yaml
- json
resources:
- interfaces
- l2_interfaces
- bgp_global
- Convert collected facts into HTML web reports using Jinja2 templates.
- Run a lightweight web server to visualize the reports.
- name: Generate Network HTML Report
hosts: network_devices
gather_facts: false
tasks:
- name: Generate Network Report
ansible.builtin.include_role:
name: network.reports.generate_web_report
vars:
file_path: "./network_reports"
- Persist generated reports into GitHub or GitLab repositories for version control and audit.
- name: Persist Reports to GitHub
hosts: network_devices
gather_facts: false
tasks:
- name: Persist Reports to GitHub Repository
ansible.builtin.include_role:
name: network.reports.persist
vars:
scm:
origin:
url: "{{ github_repo_url }}"
token: "{{ github_access_token }}"
user:
name: "{{ git_user_name }}"
email: "{{ git_user_email }}"
The project uses tox to run ansible-lint
and ansible-test sanity
. Assuming this repository is checked out in the proper structure, e.g., collections_root/ansible_collections/network/reports
, run:
tox -e ansible-lint
tox -e py39-sanity
To run integration tests, ensure that your inventory has a network_reports
group.
[network_devices]
ios
junos
[ios:vars]
< enter inventory details for IOS devices >
[junos:vars]
< enter inventory details for Junos devices >
ansible-test network-integration -i /path/to/inventory --python 3.9 [target]
We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against this repository.
Don't know how to start? Refer to the Ansible community guide!
Want to submit code changes? Take a look at the Quick-start development guide.
We also use the following guidelines:
This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.
Release notes are available here.
- Developing network resource modules
- Ansible Networking docs
- Ansible Collection Overview
- Ansible Roles overview
- Ansible User guide
- Ansible Developer guide
- Ansible Community Code of Conduct
GNU General Public License v3.0 or later.
See LICENSE to see the full text.
GNU General Public License v3.0 or later.
See LICENSE to see the full text.