Merge of RedHatGov/product-demos (#56)

Co-authored-by: MKletz <michael.kletz.27@gmail.com>
Co-authored-by: Ajay Chenampara <ajay.chenampara@gmail.com>
Co-authored-by: dlemons-redhat <69318976+dlemons-redhat@users.noreply.github.com>
Co-authored-by: Nicolas Leiva <nicolasleiva@gmail.com>
Co-authored-by: benblasco <42140583+benblasco@users.noreply.github.com>
Co-authored-by: Benjamin Blasco <bblasco@redhat.com>
Co-authored-by: calvingsmith <4283930+calvingsmith@users.noreply.github.com>
Co-authored-by: Calvin Smith <calvingsmith@users.noreply.github.com>
Co-authored-by: Hicham Mourad <43329991+HichamMourad@users.noreply.github.com>
This commit is contained in:
willtome
2023-03-17 09:07:02 -04:00
committed by GitHub
parent 8acff9c9b1
commit c18a206499
279 changed files with 5191 additions and 4649 deletions

38
network/README.md Normal file
View File

@@ -0,0 +1,38 @@
# Network Demos
## Table of Contents
- [Network Demos](#network-demos)
- [Table of Contents](#table-of-contents)
- [About These Demos](#about-these-demos)
- [Project](#project)
- [Inventory](#inventory)
- [Suggested Usage](#suggested-usage)
## About These Demos
This category of demos shows examples of network operations and management with Ansible Automation Platform. The list of demos can be found below. See the [Suggested Usage](#suggested-usage) section of this document for recommendations on how to best use these demos.
- [**NETWORK / Configuration**](https://github.com/nleiva/ansible-net-modules/blob/main/main.yml) - Deploy golden configurations for different resources to Cisco IOS, IOSXR, and NXOS.
### Project
These demos leverage playbooks from a [git repo](https://github.com/nleiva/ansible-net-modules) that is added as the **`Network Golden Configs`** Project in your Ansible Controller. Review this repo for the playbooks to configure different resources and network config templates that will be configured.
### Inventory
These demos leverage "always-on" instances for Cisco IOS, IOSXR, and NXOS from [Cisco DevNet Sandboxes](https://developer.cisco.com/docs/sandbox/#!getting-started/always-on-sandboxes). These instances are shared and do not provide admin access but they are instantly avaible all the time meaning not setup time is required.
A **`Network Inventory`** is created when setting up these demos and a dynamic source is added to populate the Always-On instances. Review the inventory file [here](https://github.com/nleiva/ansible-net-modules/blob/main/hosts).
## Suggested Usage
**NETWORK / Configuration** - Use this job to execute different [Ansible Network Resource Modules](https://docs.ansible.com/ansible/latest/network/user_guide/network_resource_modules.html) to deploy golden configs. Below is a list of the different resources the can be configured with a link to their golden config.
- [acls](https://github.com/nleiva/ansible-net-modules/blob/main/acls.cfg)
- [banner](https://github.com/nleiva/ansible-net-modules/blob/main/banner.cfg)
- [bgp_global](https://github.com/nleiva/ansible-net-modules/blob/main/bgp_global.cfg)
- [hostname](https://github.com/nleiva/ansible-net-modules/blob/main/hostname.cfg)
- [l3_interface](https://github.com/nleiva/ansible-net-modules/blob/main/l3_interface.cfg)
- [logging](https://github.com/nleiva/ansible-net-modules/blob/main/logging.cfg)
- [ntp](https://github.com/nleiva/ansible-net-modules/blob/main/ntp.cfg)
- [ospfv2](https://github.com/nleiva/ansible-net-modules/blob/main/ospfv2.cfg)
- [prefix_lists](https://github.com/nleiva/ansible-net-modules/blob/main/prefix_lists.cfg)
- [snmp](https://github.com/nleiva/ansible-net-modules/blob/main/snmp.cfg)
- [user](https://github.com/nleiva/ansible-net-modules/blob/main/user.cfg)

52
network/report.yml Normal file
View File

@@ -0,0 +1,52 @@
---
# 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 | default(omit) }}"
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)}}"
- name: Create network reports
hosts: "{{ report_server }}"
become: true
vars:
report_server: node1
web_path: /var/www/html/reports/
tasks:
- name: Build report server
ansible.builtin.include_role:
name: "{{ item }}"
loop:
- demo.patching.report_server
- demo.patching.build_report_network
- name: Update landing page
ansible.builtin.include_role:
name: demo.patching.report_server
tasks_from: linux_landing_page

106
network/setup.yml Normal file
View File

@@ -0,0 +1,106 @@
---
user_message:
controller_components:
- execution_environments
- projects
- inventories
- hosts
- inventory_sources
- inventory_source_update
- job_templates
controller_execution_environments:
- name: Networking Execution Environment
image: quay.io/nleiva/ee-network-image
controller_projects:
- name: Network Golden Configs
organization: Default
scm_type: git
scm_url: https://github.com/nleiva/ansible-net-modules
update_project: true
wait: true
default_environment: Networking Execution Environment
controller_inventories:
- name: Network Inventory
organization: Default
controller_inventory_sources:
- name: DevNet always-on sandboxes
source: scm
inventory: Network Inventory
overwrite: true
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: Default
inventory: Network Inventory
survey_enabled: true
project: Network Golden Configs
playbook: main.yml
execution_environment: Networking Execution Environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
ask_limit_on_launch: true
use_fact_cache: true
survey:
name: ''
description: ''
spec:
- question_name: What resource would you like to configure?
type: multiplechoice
variable: rm
required: true
choices:
- acls
- banner
- bgp_global
- hostname
- l3_interface
- logging
- ntp
- ospfv2
- 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
execution_environment: Networking Execution Environment
use_fact_cache: true
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