Skip to content
Puppet fact with list of PCI device identifiers
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/facter Sort the returned device list. Feb 16, 2016
spec Add comments describing how our unit test works. Feb 17, 2016
.gitignore
.travis.yml Set up automatic release from Travis CI. Feb 19, 2016
CHANGELOG.md Add changelog. Feb 19, 2016
Gemfile
README.md
Rakefile Set up automatic release from Travis CI. Feb 19, 2016
metadata.json

README.md

pci_devices_fact

Table of Contents

  1. Description
  2. Setup - The basics of getting started with pci_devices_fact
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

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.

Setup

Setup Requirements

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.

Beginning with pci_devices_fact

Once the module is installed, you can access the pci_devices fact from manifests:

notice($::pci_devices)

Usage

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.

Reference

This module provides a single fact:

pci_devices

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',
]

Limitations

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.

Development

This module is hosted in a Git repository at GitHub.

You can’t perform that action at this time.