らくがきちょう

なんとなく

Ansible で ACI 上に EPG を作成するサンプル Playbook

Ansible の ACI Moduleを使って EPG を作成する場合、Playbook のサンプルは以下の通りです。 このサンプルは GitHub でも公開しています。

---

- name: Create EPG (End Point Group)
  hosts: apic
  connection: local
  gather_facts: no

  tasks:
    - aci_bd:
        bd: "{{ inventory_hostname }}"
        host: "{{ aci }}"
        password: "{{ password }}"
        state: present
        tenant: "{{ tenant }}"
        username: "{{ username }}"
        validate_certs: false
        vrf: "{{ vrf }}"
    - aci_bd_subnet:
        bd: "{{ inventory_hostname }}"
        gateway: "{{ gateway }}"
        host: "{{ aci }}"
        mask: "{{ mask }}"
        password: "{{ password }}"
        scope: "{{ scope }}"
        tenant: "{{ tenant }}"
        username: "{{ username }}"
        validate_certs: false
    - aci_bd_to_l3out:
        bd: "{{ inventory_hostname }}"
        host: "{{ aci }}"
        l3out: "{{ l3out }}"
        password: "{{ password }}"
        state: present
        tenant: "{{ tenant }}"
        username: "{{ username }}"
        validate_certs: false
    - aci_epg:
        ap: "{{ ap }}"
        bd: "{{ inventory_hostname }}"
        epg: "{{ inventory_hostname }}"
        host: "{{ aci }}"
        password: "{{ password }}"
        state: present
        tenant: "{{ tenant }}"
        username: "{{ username }}"
        validate_certs: false
    - aci_epg_to_domain:
        ap: "{{ ap }}"
        deploy_immediacy: "{{ deploy_immediacy }}"
        domain: "{{ domain }}"
        domain_type: "{{ domain_type }}"
        epg: "{{ inventory_hostname }}"
        host: "{{ aci }}"
        password: "{{ password }}"
        resolution_immediacy: "{{ resolution_immediacy }}"
        state: present
        tenant: "{{ tenant }}"
        username: "{{ username }}"
        validate_certs: false
        vm_provider: "{{ vm_provider }}"