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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
os10_fabric_summary
=====================================
This role is used to get show system information of all devices in the fabric. This role is abstracted for Dell EMC PowerSwitch platforms running Dell EMC SmartFabric OS10.
The Fabric summary role requires an SSH connection for connectivity to a Dell EMC OS10 device. You can use any of the built-in OS connection variables.
Connection variables
--------------------
Ansible Dell EMC network roles require connection information to establish communication with the nodes in your inventory. This information can exist in the Ansible *group_vars* or *host_vars* directories or inventory, or in the playbook itself.
| Key | Required | Choices | Description |
|-------------|----------|------------|-----------------------------------------------------|
| ``ansible_host`` | yes | | Specifies the hostname or address for connecting to the remote device over the specified transport |
| ``ansible_port`` | no | | Specifies the port used to build the connection to the remote device; if value is unspecified, the `ANSIBLE_REMOTE_PORT` option is used; it defaults to 22 |
| ``os10_cli_user`` | no | | Specifies the username that authenticates the CLI login for the connection to the remote device; if value is unspecified, the default value is used |
| ``os10_cli_pass`` | no | | Specifies the password that authenticates the connection to the remote device |
| ``ansible_become`` | no | yes, no\* | Instructs the module to enter privileged mode on the remote device before sending any commands; if value is unspecified, the `ANSIBLE_BECOME` environment variable value is used, and the device attempts to execute all commands in non-privileged mode |
| ``ansible_become_method`` | no | enable, sudo\* | Instructs the module to allow the become method to be specified for handling privilege escalation; if value is unspecified, the `ANSIBLE_BECOME_METHOD` environment variable value is used |
| ``ansible_become_pass`` | no | | Specifies the password to use if required to enter privileged mode on the remote device; if ``ansible_become`` is set to no this key is not applicable |
| ``ansible_network_os`` | yes | os10, null\* | Loads the correct terminal and cliconf plugins to communicate with the remote device |
> **NOTE**: Asterisk (*) denotes the default value if none is specified.
Dependencies
------------
- *xmltodict* library should be installed to get show command output in dict format from XML
- To install the package use the *pip install xmltodict* command
Example playbook
----------------
This example uses the *os10_fabric_summary* role to completely get the show attributes. It creates a *hosts* file with the switch details and corresponding variables. The hosts file should define the ansible_network_os variable with the corresponding Dell EMC OS10 name.
The *os10_fabric_summary* role has a simple playbook that only references the *os10_fabric_summary* role.
**Sample hosts file**
site1-spine1 ansible_host=10.11.180.21 os10_cli_user=admin os10_cli_pass=admin ansible_network_os=dellemc.os10.os10
site1-spine2 ansible_host=10.11.180.22 os10_cli_user=admin os10_cli_pass=admin ansible_network_os=dellemc.os10.os10
site2-spine1 ansible_host=10.11.180.23 os10_cli_user=admin os10_cli_pass=admin ansible_network_os=dellemc.os10.os10
site2-spine2 ansible_host=10.11.180.24 os10_cli_user=admin os10_cli_pass=admin ansible_network_os=dellemc.os10.os10
[spine]
site1-spine1
site1-spine2
site2-spine1
site2-spine2
[LeafAndSpineSwitch:children]
spine
**Sample host_vars/site1-spine1**
cli:
host: "{{ ansible_host }}"
username: "{{ os10_cli_user | default('admin') }}"
password: "{{ os10_cli_pass | default('admin') }}"
timeout: 300
os10_cli_user: xxxx
os10_cli_pass: xxxx
ansible_network_os: dellemc.os10.os10
**Simple playbook to setup fabric summary — provision.yaml**
---
- name: show system summary command
hosts: localhost
gather_facts: False
connection: local
roles:
- os10_fabric_summary
**Run**
ansible-playbook -i hosts provision.yaml
**Samaple Output**
"results": [
{
"device type": "S6010-ON",
"host": "10.11.180.21",
"hostname": "host3",
"inv_name": "site1-spine1",
"node-mac": "e4:f0:04:9b:e5:dc",
"service-tag": "D33FXC2",
"software-version": "10.4.9999EX"
},
{
"device type": "S6010-ON",
"host": "10.11.180.22",
"hostname": "host22",
"inv_name": "site1-spine2",
"node-mac": "e4:f0:04:9b:eb:dc",
"service-tag": "J33FXC2",
"software-version": "10.4.9999EX"
},
{
"device type": "S6010-ON",
"host": "10.11.180.24",
"hostname": "site2-spine1",
"inv_name": "site2-spine1",
"node-mac": "e4:f0:04:9b:ee:dc",
"service-tag": "343FXC2",
"software-version": "10.4.9999EX"
},
{
"device type": "S6010-ON",
"host": "10.11.180.23",
"hostname": "site2-spine2",
"inv_name": "site2-spine2",
"node-mac": "e4:f0:04:9b:f1:dc",
"service-tag": "543FXC2",
"software-version": "10.4.9999EX"
}
]
(c) 2017-2020 Dell Inc. or its subsidiaries. All rights reserved.
|