-
Notifications
You must be signed in to change notification settings - Fork 0
/
nxos_config_port_on_leaf_AWX.yaml
52 lines (44 loc) · 1.35 KB
/
nxos_config_port_on_leaf_AWX.yaml
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
---
- name: Leaf Switch - Port Provisioning
hosts: "{{ target | default('no_hosts')}}"
gather_facts: no
connection: local
vars:
nxos_provider:
transport: cli
authorize: no
host: "{{ ansible_host }}"
# vars_prompt:
# - name: interface
# prompt: "What is the interface to configure (EthX/Y) ?"
# private: no
# - name: description
# prompt: "What is the description interface ?"
# private: no
# - name: access
# prompt: "Does the interface is access type (yes/no) ?"
# private: no
# - name: vlans
# prompt: "What is/are the vlan(s) ?"
# private: no
tasks:
- name: Configure Trunk Interface to Server on Leaf Switch
nxos_config:
lines:
- description {{ description }}
- no shutdown
- switchport mode trunk
- switchport trunk allowed vlan {{ vlans }}
parents: interface {{ interface }}
provider: "{{ nxos_provider }}"
when: access == "no"
- name: Configure Access-port to Server on Leaf Switch
nxos_config:
lines:
- description {{ description }}
- no shutdown
- switchport mode access
- switchport access vlan {{ vlans }}
parents: interface {{ interface }}
provider: "{{ nxos_provider }}"
when: access == "yes"