Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- # Demo ACI Playbook
- - name: Configuring Example Tenant with VRF , BD , APP , EPG + Static Bindings with REST
- hosts: apic1
- connection: local
- gather_facts: no
- tasks:
- - name: Build a list of VLANs
- vars:
- count: '2230'
- set_fact:
- fact_count: '{{ fact_count|default([])|union([count]) }}'
- with_sequence: start={{vlan.start}} end={{vlan.end}} stride=1
- - name: Create Tenant
- aci_tenant:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- tenant: "{{ tenant }}"
- description: "Tenant configured by Abdul via Ansible"
- validate_certs: no
- state: present
- - name: Create VRF
- aci_vrf:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- tenant: "{{ tenant }}"
- vrf: "{{ vrf }}"
- description: "VRF configured by Abdul via Ansible"
- validate_certs: no
- state: present
- - name: Create App Profile
- aci_ap:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- tenant: "{{ tenant }}"
- ap: "{{ app_profile }}"
- description: "App Profile configured by Abdul via Ansible"
- validate_certs: no
- state: present
- - name: Create BD
- aci_bd:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- tenant: "{{ tenant }}"
- vrf: "{{ vrf }}"
- bd: "bd-net{{item}}"
- description: "BD configured by Abdul via Ansible"
- enable_routing: yes
- arp_flooding: yes
- l2_unknown_unicast: flood
- validate_certs: no
- state: present
- with_sequence: start={{vlan.start}} end={{vlan.end}} stride=1
- - name: Create BD Subnet
- aci_bd_subnet:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- tenant: "{{ tenant }}"
- bd: "bd-net22{{item}}"
- gateway: "172.16.{{item}}.252"
- mask: "{{ bd.mask }}"
- scope: "private"
- description: "BD Subnet configured by Abdul via Ansible"
- validate_certs: no
- state: present
- with_sequence: start={{subnet.start}} end={{subnet.end}} stride=1
- - name: Create EPG
- aci_epg:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- tenant: "{{ tenant }}"
- ap: "{{ app_profile }}"
- epg: "epg-net{{item}}"
- bd: "bd-net{{item}}"
- description: "EPG configured by Abdul via Ansible"
- validate_certs: no
- state: present
- with_sequence: start={{vlan.start}} end={{vlan.end}} stride=1
- - name: Bind Physical Domain to EPG
- aci_epg_to_domain:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- tenant: "{{ tenant }}"
- ap: "{{ app_profile }}"
- epg: "epg-net{{item}}"
- domain: "{{ epg.domain }}"
- domain_type: phys
- validate_certs: no
- state: present
- with_sequence: start={{vlan.start}} end={{vlan.end}} stride=1
- - name: Add Static Binding of port 1 to EPG using Rest Module
- aci_rest:
- hostname: "{{ apic_host }}"
- username: "{{ apic_username }}"
- password: "{{ apic_password }}"
- path: /api/node/mo/uni/tn-{{tenant}}/ap-{{app_profile}}/epg-epg-net{{item[0]}}.json
- method: post
- content:
- {
- "fvRsPathAtt": {
- "attributes": {
- "encap": "vlan-{{item[0]}}",
- "tDn": "{{ item[1] }}"
- }
- }
- }
- validate_certs: no
- with_nested:
- - "{{count}}"
- - "{{epg.ports}}"
Add Comment
Please, Sign In to add comment