cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
556
Views
0
Helpful
1
Replies

Cisco ACI - Multiple EPGs & BDs creation using ansible

dxb-p
Level 1
Level 1

Hi,

I am able to create the Single EPG, BD, AP etc,. If I have to create more EPGs, BDs, then I am not able to create using single ansible script.

I need some help to understand like which logic / how to create Multiple EPG & BDs creation using single ansible script on ACI?

Do I have to call any variable file to create multiple object in aci?

Thanks

 

1 Reply 1

ecsnnsls
Level 1
Level 1

You can use loop in your playbook

---
- name: ACI Link Level Management
  hosts: APIC
  connection: local
  gather_facts: no
  vars:
    username: ansible
    password: ansible123!

  tasks:
    - name: Create link level policies
      cisco.aci.aci_interface_policy_link_level:
        host: '{{ inventory_hostname }}'
        user: '{{ username }}'
        password: '{{ password }}'
        validate_certs: false
        link_level_policy: "{{ item.name }}"
        auto_negotiation: "{{ item.auto }}"
        speed: "{{ item.speed }}"
        state: present
      loop:
        - { name: 'Speed_100M', auto: 'off', speed: '100M' }
        - { name: 'Speed_1G', auto: 'off', speed: '1G' }
        - { name: 'Speed_10G', auto: 'off', speed: '10G' }
        - { name: 'Speed_100G', auto: 'off', speed: '100G' }
        - { name: 'Speed_25G', auto: 'off', speed: '25G' }
        - { name: 'Speed_40G', auto: 'off', speed: '40G' }
        - { name: 'Speed_Auto', auto: 'on', speed: 'inherit' }
...

Source: https://www.mvankleij.nl/post/aci_and_ansible/

Save 25% on Day-2 Operations Add-On License