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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---

- 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 }}"