Skip to content

Commit a39757b

Browse files
authored
Merge pull request #2 from stackhpc/nic-facts
Add support for gathering NIC facts from dracclient
2 parents c656c56 + 12d140b commit a39757b

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ to function correctly.
1414
Role Variables
1515
--------------
1616

17-
None
17+
`address`: IP address or hostname of the iDRAC BMC.
18+
19+
`username`: Username credentials for the iDRAC.
20+
21+
`password`: Password credentials for the iDRAC.
1822

1923
Dependencies
2024
------------
@@ -24,16 +28,17 @@ None
2428
Example Playbook
2529
----------------
2630

27-
This role may be used as follows:
31+
With the iDRAC BMCs in the inventory, this role may be used as follows:
2832

29-
- hosts: dell-servers
33+
- hosts: dell-server-bmcs
34+
gather_facts: false
3035
roles:
3136
- role: stackhpc.drac-facts
3237
tasks:
3338
- name: Gather facts via DRAC
3439
local_action:
3540
module: drac_facts
36-
address: 1.2.3.4
41+
address: "{{ ansible_host }}"
3742
username: foo
3843
password: bar
3944

library/drac_facts.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ def get_bios_settings(bmc):
165165
return settings
166166

167167

168+
def get_nic_settings(bmc):
169+
"""Get all available NIC settings and permitted values.
170+
171+
:param bmc: A dracclient.client.DRACClient instance
172+
:returns: A dict of NIC settings
173+
"""
174+
nic_settings = bmc.list_nics()
175+
return nic_settings
176+
177+
168178
def namedtuples_to_dicts(nts):
169179
"""Convert a list of namedtuples to a list of dicts.
170180
@@ -209,11 +219,13 @@ def get_facts(module):
209219
"""
210220
bmc = build_client(module)
211221
bios_settings = get_bios_settings(bmc)
222+
nic_settings = get_nic_settings(bmc)
212223
controllers, pdisks, vdisks = get_raid_config(bmc)
213224
jobs = get_jobs(bmc, False)
214225
unfinished_jobs = get_jobs(bmc, True)
215226
return {
216227
"drac_bios_settings": bios_settings,
228+
"drac_nic_settings": nic_settings,
217229
"drac_jobs": jobs,
218230
"drac_unfinished_jobs": unfinished_jobs,
219231
"drac_raid_controllers": controllers,

0 commit comments

Comments
 (0)