- Description
- Setup - The basics of getting started with pci_devices_fact
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
This module provides the pci_devices
-fact, which contains an array of PCI IDs for the node.
The pci_devices
fact can then be used to check available hardware on the node from within Puppet manifests.
This module requires pushing a new fact to the node, and therefore requires pluginsync
to be enabled on the Puppet agent.
The fact is returned as an array, so if you are running Puppet 3.8 or older, you need to verify that the stringify_facts
option is set to false
.
Once the module is installed, you can access the pci_devices
fact from manifests:
notice($::pci_devices)
The pci_devices
fact can be used to test for specific hardware in Puppet manifests.
The simplest way is to use the in
-operator to check for the precence of one element in the array.
For example, to install the Realtek firmware if the machine has one of their WiFi adapters:
if '10ec:8176' in $::pci_devices {
# RTL8188CE 802.11b/g/n WiFi Adapter
# http://pci-ids.ucw.cz/read/PC/10ec/8176
ensure_packages('firmware-realtek')
}
To list the PCI IDs of the devices on the node, you can use the lspci
utility with the -nn
argument:
$ lspci -nn
[...]
01:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter [10ec:8176] (rev 01)
The PCI ID is printed in the square brackets towards the end of the line.
This module provides a single fact:
An array of PCI device identifiers for devices in the node. For example:
pci_devices => [
'10ec:8168',
'10ec:8176',
'1b21:1142',
'8086:0154',
'8086:0156',
'8086:1e03',
'8086:1e10',
'8086:1e12',
'8086:1e14',
'8086:1e16',
'8086:1e20',
'8086:1e22',
'8086:1e26',
'8086:1e2d',
'8086:1e3a',
'8086:1e5f',
]
This module retrieves the device list by enumerating the PCI devices found in sysfs on Linux. As such, only Linux is supported, and sysfs must be available to the Puppet agent.
This module is hosted in a Git repository at GitHub.