Add network report job template (#44)

* Network report
This commit is contained in:
Nicolas Leiva
2022-11-30 15:46:40 -05:00
committed by GitHub
parent efcf729fa0
commit 07a9f64fd2
23 changed files with 621 additions and 386 deletions

58
network/report.yml Normal file
View File

@@ -0,0 +1,58 @@
---
# Re-write of:
# https://github.com/network-automation/toolkit/blob/master/playbooks/network_report.yml
# https://github.com/network-automation/toolkit/blob/master/roles/build_report/tasks/main.yml
- name: Collect facts
hosts: "{{ HOSTS }}"
gather_facts: false
tasks:
- name: Gather all network resource and minimal legacy facts [Cisco IOS]
cisco.ios.ios_facts:
gather_subset: min
gather_network_resources: all
when: ansible_network_os == 'cisco.ios.ios'
- name: Gather all network resource and minimal legacy facts [Cisco NX-OS]
cisco.nxos.nxos_facts:
gather_subset: min
gather_network_resources: all
when: ansible_network_os == 'cisco.nxos.nxos'
- name: Gather all network resource and minimal legacy facts [Cisco IOS XR]
cisco.iosxr.iosxr_facts:
gather_subset: min
gather_network_resources: all
when: ansible_network_os == 'cisco.iosxr.iosxr'
# The dig lookup requires the python 'dnspython' library
# - name: Resolve IP address
# ansible.builtin.set_fact:
# ansible_host: "{{ lookup('community.general.dig', inventory_hostname)}}"
- hosts: node1
become: yes
vars:
report_server: node1
web_path: /var/www/html/reports/
tasks:
- ansible.builtin.include_role:
name: "{{ item }}"
loop:
- demo.patching.report_server
- demo.patching.build_report_network
- block:
- ansible.builtin.include_role:
name: "{{ item }}"
loop:
- demo.patching.report_server
- demo.patching.build_report_network
- ansible.builtin.include_role:
name: demo.patching.report_server
tasks_from: linux_landing_page
delegate_to: "{{ report_server }}"
run_once: yes

View File

@@ -2,22 +2,16 @@
user_message:
controller_components:
- organizations
- projects
- inventories
- hosts
- inventory_sources
- inventory_source_update
- job_templates
controller_organizations:
- name: Networking
galaxy_credentials:
- Automation Hub
- Ansible Galaxy
controller_projects:
- name: Network Golden Configs
organization: Networking
organization: Default
scm_type: git
scm_url: https://github.com/nleiva/ansible-net-modules
update_project: yes
@@ -25,7 +19,7 @@ controller_projects:
controller_inventories:
- name: Network Inventory
organization: Networking
organization: Default
controller_inventory_sources:
- name: DevNet always-on sandboxes
@@ -35,9 +29,16 @@ controller_inventory_sources:
source_project: Network Golden Configs
source_path: hosts
controller_hosts:
- name: node1
inventory: Network Inventory
variables:
ansible_user: rhel
ansible_host: node1
controller_templates:
- name: NETWORK / Configuration
organization: Networking
organization: Default
inventory: Network Inventory
survey_enabled: true
project: Network Golden Configs
@@ -67,3 +68,32 @@ controller_templates:
- prefix_lists
- snmp
- user
- name: "NETWORK / Report"
job_type: check
organization: Default
inventory: Network Inventory
project: "Ansible official demo project"
playbook: "network/report.yml"
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
use_fact_cache: true
ask_job_type_on_launch: yes
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: What devices do you want to include in the report?
type: multiplechoice
variable: HOSTS
default: routers
required: true
choices:
- sandbox-iosxe-latest-1.cisco.com
- sandbox-iosxr-1.cisco.com
- sandbox-nxos-1.cisco.com
- routers