| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
- name: Test that we have an ACI APIC host, ACI username and ACI password |
| 7 |
ansible.builtin.fail: |
| 8 |
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.' |
| 9 |
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined |
| 10 |
|
| 11 |
- name: Set vars |
| 12 |
ansible.builtin.set_fact: |
| 13 |
aci_info: &aci_info |
| 14 |
host: "{{ aci_hostname }}" |
| 15 |
username: "{{ aci_username }}" |
| 16 |
password: "{{ aci_password }}" |
| 17 |
validate_certs: '{{ aci_validate_certs | default(false) }}' |
| 18 |
use_ssl: '{{ aci_use_ssl | default(true) }}' |
| 19 |
use_proxy: '{{ aci_use_proxy | default(true) }}' |
| 20 |
output_level: debug |
| 21 |
|
| 22 |
|
| 23 |
- name: Remove the ansible_tenant |
| 24 |
cisco.aci.aci_tenant: |
| 25 |
<<: *aci_info |
| 26 |
tenant: ansible_tenant |
| 27 |
state: absent |
| 28 |
|
| 29 |
- name: Verify Cloud and Non-Cloud Sites in use. |
| 30 |
ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml |
| 31 |
|
| 32 |
- name: Execute tasks only for non-cloud sites |
| 33 |
when: query_cloud.current == [] |
| 34 |
block: |
| 35 |
- name: Add a new tenant |
| 36 |
cisco.aci.aci_tenant: |
| 37 |
<<: *aci_info |
| 38 |
tenant: ansible_tenant |
| 39 |
description: Ansible tenant |
| 40 |
state: present |
| 41 |
|
| 42 |
- name: Add New L2Out |
| 43 |
cisco.aci.aci_l2out: |
| 44 |
<<: *aci_info |
| 45 |
tenant: ansible_tenant |
| 46 |
l2out: ansible_l2out |
| 47 |
description: Ansible Test |
| 48 |
bd: ansible_bd |
| 49 |
domain: l2Dom |
| 50 |
vlan: 3200 |
| 51 |
state: present |
| 52 |
register: add_l2out |
| 53 |
|
| 54 |
- name: Add another L2Out |
| 55 |
cisco.aci.aci_l2out: |
| 56 |
<<: *aci_info |
| 57 |
tenant: ansible_tenant |
| 58 |
l2out: ansible_l2out_2 |
| 59 |
description: Ansible Test |
| 60 |
bd: ansible_bd |
| 61 |
domain: l2Dom |
| 62 |
vlan: 3200 |
| 63 |
state: present |
| 64 |
register: add_l2out_2 |
| 65 |
|
| 66 |
- name: Add L2 external end point group |
| 67 |
cisco.aci.aci_l2out_extepg: |
| 68 |
<<: *aci_info |
| 69 |
tenant: ansible_tenant |
| 70 |
l2out: ansible_l2out |
| 71 |
extepg: ansible_extepg |
| 72 |
description: Ansible external epg |
| 73 |
preferred_group: True |
| 74 |
state: present |
| 75 |
register: l2extepg |
| 76 |
|
| 77 |
- name: Verify l2extepg |
| 78 |
ansible.builtin.assert: |
| 79 |
that: |
| 80 |
- l2extepg.current.0.l2extInstP.attributes.dn == "uni/tn-ansible_tenant/l2out-ansible_l2out/instP-ansible_extepg" |
| 81 |
- l2extepg.current.0.l2extInstP.attributes.annotation == 'orchestrator:ansible' |
| 82 |
|
| 83 |
- name: Add L2 external end point group again |
| 84 |
cisco.aci.aci_l2out_extepg: |
| 85 |
<<: *aci_info |
| 86 |
tenant: ansible_tenant |
| 87 |
l2out: ansible_l2out |
| 88 |
extepg: ansible_extepg |
| 89 |
description: Ansible external epg |
| 90 |
preferred_group: True |
| 91 |
state: present |
| 92 |
register: l2extepg_again |
| 93 |
|
| 94 |
- name: Verify l2extepg_again |
| 95 |
ansible.builtin.assert: |
| 96 |
that: |
| 97 |
- l2extepg_again is not changed |
| 98 |
- l2extepg.current.0.l2extInstP.attributes.dn == "uni/tn-ansible_tenant/l2out-ansible_l2out/instP-ansible_extepg" |
| 99 |
|
| 100 |
- name: Add another L2 external end point group |
| 101 |
cisco.aci.aci_l2out_extepg: |
| 102 |
<<: *aci_info |
| 103 |
tenant: ansible_tenant |
| 104 |
l2out: ansible_l2out_2 |
| 105 |
extepg: ansible_extepg_2 |
| 106 |
description: Ansible external epg |
| 107 |
qos_class: level1 |
| 108 |
preferred_group: True |
| 109 |
state: present |
| 110 |
register: l2extepg_2 |
| 111 |
|
| 112 |
- name: Verify l2extepg_2 |
| 113 |
ansible.builtin.assert: |
| 114 |
that: |
| 115 |
- l2extepg_2.current.0.l2extInstP.attributes.dn == "uni/tn-ansible_tenant/l2out-ansible_l2out_2/instP-ansible_extepg_2" |
| 116 |
|
| 117 |
- name: Query the L2 external end point group |
| 118 |
cisco.aci.aci_l2out_extepg: |
| 119 |
<<: *aci_info |
| 120 |
tenant: ansible_tenant |
| 121 |
l2out: ansible_l2out |
| 122 |
extepg: ansible_extepg |
| 123 |
state: query |
| 124 |
register: query_l2extepg |
| 125 |
|
| 126 |
- name: Query all L2 external epg in a tenant |
| 127 |
cisco.aci.aci_l2out_extepg: |
| 128 |
<<: *aci_info |
| 129 |
tenant: ansible_tenant |
| 130 |
state: query |
| 131 |
register: query_all_in_tenant |
| 132 |
|
| 133 |
- name: Verify query_all_in_tenant |
| 134 |
ansible.builtin.assert: |
| 135 |
that: |
| 136 |
- query_all_in_tenant is not changed |
| 137 |
|
| 138 |
- name: Query all L2 external epgs |
| 139 |
cisco.aci.aci_l2out_extepg: |
| 140 |
<<: *aci_info |
| 141 |
state: query |
| 142 |
register: query_all |
| 143 |
|
| 144 |
- name: Verify query_all |
| 145 |
ansible.builtin.assert: |
| 146 |
that: |
| 147 |
- query_all is not changed |
| 148 |
|
| 149 |
- name: Remove L2 external end point group |
| 150 |
cisco.aci.aci_l2out_extepg: |
| 151 |
<<: *aci_info |
| 152 |
tenant: ansible_tenant |
| 153 |
l2out: ansible_l2out |
| 154 |
extepg: ansible_extepg |
| 155 |
preferred_group: True |
| 156 |
state: absent |
| 157 |
register: remove_l2extepg |
| 158 |
|
| 159 |
- name: Verify remove_l2extepg |
| 160 |
ansible.builtin.assert: |
| 161 |
that: |
| 162 |
- remove_l2extepg is changed |
| 163 |
- remove_l2extepg.previous.0.l2extInstP.attributes.dn == "uni/tn-ansible_tenant/l2out-ansible_l2out/instP-ansible_extepg" |