libs: add ceph_osd_devices fact listing ceph OSD block devices (#504)

A forthcoming profile needs to set the I/O scheduler to noop/none on the disks backing ceph OSDs, so Puppet must know which block devices those are. This fact surfaces them by inspecting LVM PVs whose volume group belongs to ceph.

- add ceph_osd_devices fact returning the sorted array of PV device paths whose VG name starts with ceph-
- confine the fact to physical Linux hosts with pvs installed so it never resolves on VMs

https://claude.ai/code/session_01JUoARVdmhxKQHyyyp1pxeT
Reviewed-on: #504
Co-authored-by: Ben Vincent <ben@unkin.net>
Co-committed-by: Ben Vincent <ben@unkin.net>
This commit was merged in pull request #504.
This commit is contained in:
2026-08-02 17:25:18 +10:00
committed by BenVincent
parent dd38651a9f
commit d5cfaed7d4
@@ -0,0 +1,23 @@
# frozen_string_literal: true
require 'facter'
Facter.add(:ceph_osd_devices) do
confine kernel: 'Linux'
confine { Facter.value(:is_virtual) == false }
confine { Facter::Core::Execution.which('pvs') }
setcode do
devices = []
output = Facter::Core::Execution.execute(
'pvs --noheadings -o pv_name,vg_name 2>/dev/null',
on_fail: nil
)
output&.each_line do |line|
pv_name, vg_name = line.split
next unless pv_name && vg_name
devices << pv_name if vg_name.start_with?('ceph-')
end
devices.sort
end
end