From d5cfaed7d4317033eb1bdeb1cc74434a6e39a639 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 2 Aug 2026 17:25:18 +1000 Subject: [PATCH] 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: https://git.unkin.net/unkin/puppet-prod/pulls/504 Co-authored-by: Ben Vincent Co-committed-by: Ben Vincent --- modules/libs/lib/facter/ceph_osd_devices.rb | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 modules/libs/lib/facter/ceph_osd_devices.rb diff --git a/modules/libs/lib/facter/ceph_osd_devices.rb b/modules/libs/lib/facter/ceph_osd_devices.rb new file mode 100644 index 0000000..45bb0d6 --- /dev/null +++ b/modules/libs/lib/facter/ceph_osd_devices.rb @@ -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