-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphy.yml
51 lines (51 loc) · 2.16 KB
/
phy.yml
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
---
- hosts: apic
vars: # do not '| unique'
at: ' {% for ap in aps -%}{{ ap | map("extract", aps) | first }},{%- endfor -%}' # Keep initial whitespaces.
ats: '[ {{ at[:-1] | trim }} ]' # Without this precise trick single container might result in tuple because trailing comma!
et: ' {% for eps in ats -%}{%- for ep in eps -%}{{ ep | map("extract", eps) | first }},{%- endfor -%}{%- endfor -%}'
es: '[ {{ et[:-1] | trim }} ]' # The same.
ps: '{{ es | flatten | map(attribute="phy") | map("extract", phys) | list }}'
ds: '{{ es | flatten | map(attribute="dom") | map("extract", doms) | list }}'
tasks:
- aci_interface_policy_leaf_policy_group: #&ifpg
<<: &st-ol
state: '{{ intent }}'
output_level: '{{ output_level }}'
policy_group: '{{ item.0.ifpg }}' #&pg
aep: '{{ item.1.aep }}'
lag_type: leaf
lldp_policy: LLDP:En
mcp_policy: MCP:En
args: '{{ aci_vars }}'
with_together:
- '{{ ps }}'
- '{{ ds }}'
ignore_errors: '{{ intent == "absent" }}'
- aci_interface_policy_leaf_profile: #&iflfp
<<: *st-ol
leaf_interface_profile: '{{ item.ifp }}'
args: '{{ aci_vars }}'
with_list: '{{ ps }}'
ignore_errors: '{{ intent == "absent" }}'
#- TBD: clear 'missing-target' created by aci_interface_selector_to_switch_policy_leaf_profile
- meta: end_play
when: intent == "absent"
- aci_access_port_to_interface_policy_leaf_profile:
<<: *st-ol
leaf_interface_profile: '{{ item.ifp }}'
access_port_selector: 1.{{ item.prt }} # 1. for baby switch
leaf_port_blk: 1.{{ item.prt }} # single, sep with .. for range
from: '{{ item.prt }}'
to: '{{ item.prt }}'
policy_group: '{{ item.ifpg }}'
args: '{{ aci_vars }}'
with_list: '{{ ps }}'
#- aci_switch_policy_leaf_profile: TBD
#- aci_switch_leaf_selector: TBD
- aci_interface_selector_to_switch_policy_leaf_profile:
<<: *st-ol
interface_selector: '{{ item.ifp }}' # Why not leaf_interface_profile, FCS.
leaf_profile: '{{ item.swp }}'
args: '{{ aci_vars }}'
with_list: '{{ ps }}'