HomeGuidesAPI Reference
GuidesAPI ReferenceGitHubAirheads Developer CommunityLog In
Guides

Example Workflows

Day 0 Operations

These Day 0 playbooks pertain to configurations that are performed after the basic configuration is completed and the switches are reachable from HPEANFC. These playbooks contain configuration that is done as the first step, hence they are kept under Day0 automation.

Discover Switches

This example playbook will discover the provided switches and add them to Fabric Composer:

---
- name: Playbook to run Discover
  hosts: all
  collections:
    - arubanetworks.afc
  gather_facts: false
  tasks:
    - name: Day0 | Discovery | Discover switches with IP address 
      arubanetworks.afc.afc_discovery:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        data:
          admin_passwd: "admin"
          afc_admin_passwd: "admin"
          switches:
              - 10.156.11.166
              - 10.156.14.253
              - 10.156.11.255
              - 10.156.19.167
              - 10.156.15.109
              - 10.156.18.255

Create Fabric

This example playbook will create a fabric within HPEANFC with the specified name and time zone:

---
- name: Playbook to Create Fabric
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Day0 | create_fabric | Create Fabric
      arubanetworks.afc.afc_fabric:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        operation: 'create'
        data:
          name: "DCN-Rsvl-Fabric"
          timezone: "America/Los_Angeles"

Assign Fabric

This example playbook will assign devices defined by IP address to the specified fabric:

---
- name: Playbook to assign Fabric
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Day0 | assign_fabric | Assign Fabric using username and password
      arubanetworks.afc.afc_fabric:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        operation: 'assign'
        data:
          fabric: "DCN-Rsvl-Fabric"
          roles:
            10.156.11.166: "border_leaf"
            10.156.14.253: "border_leaf"
            10.156.11.255: "spine"
            10.156.15.109: "spine"
            10.156.19.167: "leaf"
            10.156.18.255: "leaf"

Day N Automation

These Day N playbooks show examples of incremental configuration changes that are performed after the basic configuration is completed and the switches are reachable from Fabric Composer. There are a number of different varieties of implementation, the following workflows are to be used as an example

---
- name: Playbook to configure fabric
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Create IPv4 resource pool
      arubanetworks.afc.afc_resource_pool:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        operation: "create"
        data:
            name: "IP-POOL"
            type: "IPv4"
            pool_ranges: "10.10.20.0/24"

    - name: Create MAC resource pool
      arubanetworks.afc.afc_resource_pool:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        operation: "create"
        data:
            name: "MAC-POOL"
            type: "MAC"
            pool_ranges: "02:00:00:00:00:01-02:00:00:00:00:FF"
          
    - name: Day1 | create_vrf | Create VRF
      arubanetworks.afc.afc_vrf:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        operation: 'create'
        data:        
            fabric: "DCN-Rsvl-Fabric"
            name: "red"
---
- name: Playbook to configure fabric Overlay
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Create an underlay configuration using username and password
      arubanetworks.afc.afc_underlay:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        operation: "create"
        data:
          name: "Test-underlay"
          fabric: "Aruba-Fabric"
          ipv4_address: 'IP POOL'
          transit_vlan: 120
          underlay_type: 'OSPF'

    - name: Create an overlay configuration
      arubanetworks.afc.afc_overlay:
        afc_ip: "{{ afc_ip }}"
        afc_username: "{{ afc_username }}"
        afc_password: "{{ afc_password }}"
        operation: "create"
        data:
          name: "Test-Overlay"
          ipv4_address: 'IP POOL'
          spine_leaf_asn: "65000"
          vrf: "default"
          fabric: "Aruba-Fabric"
          bgp_type: "internal"