Network automation with Ansible validated content_Cover

Network automation with Ansible validated content

Rohit Thakur

Tags:

English

About

Ansible validated content is a set of collections that contain content such as Ansible plug-ins, roles, and playbooks to address common automation use cases. You can use validated content collections to automate faster and more efficiently with Red Hat Ansible Automation Platform

The Network Border Gateway Protocol (BGP) validated content collection focuses on platform-agnostic network automation and supports the BGP management experience by providing production-ready content. 

This cheat sheet covers basic commands and tasks for using Network BGP-validated content, including:

  • list
  • gather
  • deploy
  • persist
  • health_check

With Red Hat Developer cheat sheets, you get essential information right at your fingertips so you can work faster and smarter. Easily learn new technologies and coding concepts and quickly find the answers you need.

Excerpt

Create brownfield inventory

persist

ansible.builtin.include_role:
      name: network.bgp.run
    vars:
      actions:
        - name: persist

Fetches and persists the running BGP configuration.

Example:

This task fetches the running config and saves the facts in terms of host_vars on the provided/default inventory path. This inventory can act as a source of truth (SOT) for other operations.

The playbook would look like following:

- hosts: ios
  tasks:
  - name: Create run time inventory with host-vars(Facts).
    ansible.builtin.include_role:
      name:  network.bgp.run
    vars:
      actions:
        -name: persist


$ ansible-playbook -i inventory.yaml persist.yml
$ tree inventory
inventory
├── host_vars
│   └── 192.168.122.220
│       ├── bgp_address_family.yaml
│       └── bgp_global.yaml
└── inventory.yaml


$ cat inventory/host_vars/192.168.122.220/bgp_global.yaml
bgp_global:
    as_number: '500'
    bgp:
        log_neighbor_changes: true
    neighbors:
    -   neighbor_address: 12.0.0.1
        remote_as: '500'
        update_source: Loopback0
    -   neighbor_address: 23.0.0.1
        remote_as: '500'
    networks:
    -   address: 10.0.0.0

Related Cheat sheets