- change /etc/hosts to meet proxmox requirements - add proxmox node role - add init, params, repo, install, clusterjoin classes
35 lines
868 B
Ruby
35 lines
868 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'facter'
|
|
|
|
Facter.add('ceph_global_config') do
|
|
confine enc_role: 'roles::infra::proxmox::node'
|
|
setcode do
|
|
config_file = '/etc/pve/ceph.conf'
|
|
config_hash = {}
|
|
in_global_section = false
|
|
|
|
if File.exist?(config_file)
|
|
File.readlines(config_file).each do |line|
|
|
line.strip!
|
|
# Detect the [global] section and set flag
|
|
if line == '[global]'
|
|
in_global_section = true
|
|
next
|
|
end
|
|
|
|
# Exit the loop once we're out of the global section
|
|
break if line.start_with?('[') && in_global_section
|
|
|
|
# Parse key-value pairs if we are in the global section
|
|
if in_global_section && line.include?('=')
|
|
key, value = line.split('=', 2).map(&:strip)
|
|
config_hash[key] = value
|
|
end
|
|
end
|
|
end
|
|
|
|
config_hash
|
|
end
|
|
end
|