Ansible part for_po_c(w dellos9 dellos10)_ext_v1.0
1. Simple PoC for Ansible /w dellos9 & dellos10
This document is the purpose of quick PoC for Ansible on the DELL EMC OS9 & 10
Copyright <2018> Hoon_Jo@dell.com < Github : https://github.com/sysnet4admin>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3. 1. dellos[9|10]_command
1.1. Source Code
---
- name: Show for Dell_OS9
hosts: leaf_os9
gather_facts: no
tasks:
- name: Show Version
dellos9_command:
commands: show version
register: show_ver
- debug: var=show_ver
[Code 1-1] Show_Version9.yml
---
- name: Show for Dell_OS10
hosts: leaf_os10
gather_facts: no
tasks:
- name: Show Version
dellos10_command:
commands: show version
register: show_ver
- debug: var=show_ver
[Code 1-2] Show_Version10.yml
1.2. Run the Code
Note: anp = ansible-playbook (alias)
[vagrant@ansible-server Ver_Chk]$ anp Show_Version9.yml
PLAY [Show for Dell_OS9] *******************************************************
TASK [Show Version] ************************************************************
ok: [192.168.0.14]
ok: [192.168.0.13]
TASK [debug] *******************************************************************
ok: [192.168.0.14] => {
"show_ver": {
"changed": false,
"failed": false,
"stdout": [
"Dell EMC Real Time Operating System SoftwarenDell EMC Operating
System Version: 2.0nDell EMC Application Software Version: 9.14(0.2)nCopyright
(c) 1999-2018 by Dell Inc. All Rights Reserved.nBuild Time: Sat Sep 22 02:36:57
2018nBuild Path: /build/build02/SW/SRCnDell EMC Networking OS uptime is 1
4. day(s), 20 hour(s), 33 minute(s)nnSystem image file is "system://A"nnSystem
Type: S5048F-ON nControl Processor: Intel Rangeley with 3 Gbytes (3203260416
bytes) of memory, core(s) 4.nn16G bytes of boot flash memory.nn 1 54-port
TE/TF/FO/FI/HU G (S5048F-ON)n 48 Twenty Five GigabitEthernet/IEEE 802.3
interface(s)n 5 Forty GigabitEthernet/IEEE 802.3 interface(s)n 1 Hundred
GigabitEthernet/IEEE 802.3 interface(s)"
],
"stdout_lines": [
[
"Dell EMC Real Time Operating System Software",
"Dell EMC Operating System Version: 2.0",
"Dell EMC Application Software Version: 9.14(0.2)",
"Copyright (c) 1999-2018 by Dell Inc. All Rights Reserved.",
"Build Time: Sat Sep 22 02:36:57 2018",
"Build Path: /build/build02/SW/SRC",
"Dell EMC Networking OS uptime is 1 day(s), 20 hour(s), 33
minute(s)",
"",
"System image file is "system://A"",
"",
"System Type: S5048F-ON ",
"Control Processor: Intel Rangeley with 3 Gbytes (3203260416
bytes) of memory, core(s) 4.",
"",
"16G bytes of boot flash memory.",
"",
" 1 54-port TE/TF/FO/FI/HU G (S5048F-ON)",
" 48 Twenty Five GigabitEthernet/IEEE 802.3 interface(s)",
" 5 Forty GigabitEthernet/IEEE 802.3 interface(s)",
" 1 Hundred GigabitEthernet/IEEE 802.3 interface(s)"
]
]
}
}
ok: [192.168.0.13] => {
"show_ver": {
"changed": false,
"failed": false,
"stdout": [
"Dell EMC Real Time Operating System SoftwarenDell EMC Operating
System Version: 2.0nDell EMC Application Software Version: 9.14(0.2)nCopyright
(c) 1999-2018 by Dell Inc. All Rights Reserved.nBuild Time: Sat Sep 22 02:36:57
2018nBuild Path: /build/build02/SW/SRCnDell EMC Networking OS uptime is 1
day(s), 16 hour(s), 26 minute(s)nnSystem image file is "system://A"nnSystem
Type: S5048F-ON nControl Processor: Intel Rangeley with 3 Gbytes (3203248128
bytes) of memory, core(s) 4.nn16G bytes of boot flash memory.nn 1 54-port
TE/TF/FO/FI/HU G (S5048F-ON)n 48 Twenty Five GigabitEthernet/IEEE 802.3
interface(s)n 4 Forty GigabitEthernet/IEEE 802.3 interface(s)n 2 Hundred
GigabitEthernet/IEEE 802.3 interface(s)"
],
"stdout_lines": [
[
"Dell EMC Real Time Operating System Software",
"Dell EMC Operating System Version: 2.0",
"Dell EMC Application Software Version: 9.14(0.2)",
"Copyright (c) 1999-2018 by Dell Inc. All Rights Reserved.",
"Build Time: Sat Sep 22 02:36:57 2018",
"Build Path: /build/build02/SW/SRC",
"Dell EMC Networking OS uptime is 1 day(s), 16 hour(s), 26
5. minute(s)",
"",
"System image file is "system://A"",
"",
"System Type: S5048F-ON ",
"Control Processor: Intel Rangeley with 3 Gbytes (3203248128
bytes) of memory, core(s) 4.",
"",
"16G bytes of boot flash memory.",
"",
" 1 54-port TE/TF/FO/FI/HU G (S5048F-ON)",
" 48 Twenty Five GigabitEthernet/IEEE 802.3 interface(s)",
" 4 Forty GigabitEthernet/IEEE 802.3 interface(s)",
" 2 Hundred GigabitEthernet/IEEE 802.3 interface(s)"
]
]
}
}
PLAY RECAP *********************************************************************
192.168.0.13 : ok=2 changed=0 unreachable=0 failed=0
192.168.0.14 : ok=2 changed=0 unreachable=0 failed=0
[vagrant@ansible-server Ver_Chk]$ anp Show_Version10.yml
PLAY [Show for Dell_OS10] ******************************************************
TASK [Show Version] ************************************************************
ok: [192.168.0.16]
TASK [debug] *******************************************************************
ok: [192.168.0.16] => {
"show_ver": {
"changed": false,
"failed": false,
"stdout": [
"Dell EMC Networking OS10-EnterprisenCopyright (c) 1999-2018 by Dell
Inc. All Rights Reserved.nOS Version: 10.4.2.0nBuild Version:
10.4.2.0.226nBuild Time: 2018-11-08T21:43:05-0800nSystem Type: S4148U-
ONnArchitecture: x86_64nUp Time: 5 days 18:35:57"
],
"stdout_lines": [
[
"Dell EMC Networking OS10-Enterprise",
"Copyright (c) 1999-2018 by Dell Inc. All Rights Reserved.",
"OS Version: 10.4.2.0",
"Build Version: 10.4.2.0.226",
"Build Time: 2018-11-08T21:43:05-0800",
"System Type: S4148U-ON",
"Architecture: x86_64",
"Up Time: 5 days 18:35:57"
]
]
}
}
PLAY RECAP *********************************************************************
192.168.0.16 : ok=2 changed=0 unreachable=0 failed=0
6. 2. dellos[9|10]_config
2.1. Source Code
---
- name: Config for Dell_OS9
hosts: leaf_os9
gather_facts: no
vars_prompt:
- name: "vlan"
prompt: "Which vlan do you want to create"
private: no
tasks:
- name: input vlan for DellOS9
dellos9_config:
lines: ['interface vlan {{ vlan }}']
[Code 2-1] Create_Vlan_v9.yml
---
- name: Config for Dell_OS10
hosts: leaf_os10
gather_facts: no
vars_prompt:
- name: "vlan"
prompt: "Which vlan do you want to create"
private: no
tasks:
- name: input vlan for DellOS10
dellos10_config:
lines: ['interface vlan {{ vlan }}']
[Code 2-2] Create_Vlan_v10.yml
2.2. Run the Code
Note: anp = ansible-playbook (alias)
[vagrant@ansible-server Cr_Vlan]$ anp Create_Vlan_v9.yml
Which vlan do you want to create: 301
PLAY [Config for Dell_OS9] *****************************************************
TASK [input vlan for DellOS9] **************************************************
changed: [192.168.0.14]
changed: [192.168.0.13]
PLAY RECAP ********************************************************************
192.168.0.13 : ok=1 changed=1 unreachable=0 failed=0
192.168.0.14 : ok=1 changed=1 unreachable=0 failed=0
[vagrant@ansible-server Cr_Vlan]$ ansible-playbook Create_Vlan_v10.yml
Which vlan do you want to create: 301
7. PLAY [Config for Dell_OS10] ****************************************************
TASK [input vlan for DellOS10] *************************************************
changed: [192.168.0.16]
PLAY RECAP *********************************************************************
192.168.0.16 : ok=1 changed=1 unreachable=0 failed=0
2.3. Check Status
[ Leaf-1: show vlan ]
Leaf-1(conf)#do show vlan
Codes: * - Default VLAN, G - GVRP VLANs, R - Remote Port Mirroring VLANs, P - Primary, C
- Community, I - Isolated
O - Openflow, Vx - Vxlan
Q: U - Untagged, T - Tagged
x - Dot1x untagged, X - Dot1x tagged
o - OpenFlow untagged, O - OpenFlow tagged
G - GVRP tagged, M - Vlan-stack
i - Internal untagged, I - Internal tagged, v - VLT untagged, V - VLT tagged
NUM Status Description Q Ports
* 1 Active U Po1(Fo 1/53/1,1/54/1)
U Tf 1/9-1/10,1/13-1/16,1/20,
1/23-1/30,1/32,1/34-1/36
99 Active V Po1(Fo 1/53/1,1/54/1)
100 Active T Po12(Tf 1/12)
T Po22(Tf 1/22)
V Po1(Fo 1/53/1,1/54/1)
T Tf 1/1-1/5,1/8
101 Active V Po1(Fo 1/53/1,1/54/1)
T Tf 1/1-1/5,1/8,1/11,1/21
U Tf 1/17-1/19,1/31,1/33,1/46-1/48
102 Active T Po12(Tf 1/12)
T Po22(Tf 1/22)
V Po1(Fo 1/53/1,1/54/1)
T Tf 1/1-1/5,1/8
103 Active T Po12(Tf 1/12)
T Po22(Tf 1/22)
V Po1(Fo 1/53/1,1/54/1)
T Tf 1/1-1/5,1/8,1/11,1/21
301 Active V Po1(Fo 1/53/1,1/54/1)
[ Leaf-2: show vlan ]
Leaf-2#show vlan
Codes: * - Default VLAN, G - GVRP VLANs, R - Remote Port Mirroring VLANs, P - Primary, C
- Community, I - Isolated
O - Openflow, Vx - Vxlan
Q: U - Untagged, T - Tagged
x - Dot1x untagged, X - Dot1x tagged
o - OpenFlow untagged, O - OpenFlow tagged
G - GVRP tagged, M - Vlan-stack
i - Internal untagged, I - Internal tagged, v - VLT untagged, V - VLT tagged
NUM Status Description Q Ports
* 1 Active U Po1(Fo 1/53/1,1/54/1)
8. 99 Active V Po1(Fo 1/53/1,1/54/1)
100 Active T Po12(Tf 1/12)
T Po22(Tf 1/22)
V Po1(Fo 1/53/1,1/54/1)
101 Active V Po1(Fo 1/53/1,1/54/1)
T Tf 1/11,1/21
U Tf 1/31,1/46-1/48
102 Active T Po12(Tf 1/12)
T Po22(Tf 1/22)
V Po1(Fo 1/53/1,1/54/1)
103 Active T Po12(Tf 1/12)
T Po22(Tf 1/22)
V Po1(Fo 1/53/1,1/54/1)
T Tf 1/11,1/21
301 Active V Po1(Fo 1/53/1,1/54/1)
[ Leaf-3: show vlan ]
Leaf-3# show vlan
Codes: * - Default VLAN, M - Management VLAN, R - Remote Port Mirroring VLANs,
@ โ Attached to Virtual Network
Q: A - Access (Untagged), T - Tagged
NUM Status Description Q Ports
* 1 Active A Eth1/1/1-1/1/2,1/1/5-1/1/6,
1/1/8-1/1/9,1/1/11-1/1/28,
1/1/30-1/1/32,1/1/35-1/1/42,
1/1/45,1/1/49-1/1/54
A Po32,42
200 Active T Eth1/1/31-1/1/32,1/1/41-1/1/42
T Po32,42
201 Active T Eth1/1/31-1/1/32,1/1/41-1/1/42
T Po32,42
A Eth1/1/46-1/1/48
202 Active T Eth1/1/31-1/1/32,1/1/41-1/1/42
T Po32,42
203 Active T Eth1/1/31-1/1/32,1/1/41-1/1/42
T Po32,42
301 Inactive
4094 Inactive