- change /etc/hosts to meet proxmox requirements - add proxmox node role - add init, params, repo, install, clusterjoin classes
29 lines
718 B
Ruby
29 lines
718 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'facter'
|
|
|
|
Facter.add('pve_cluster') do
|
|
confine enc_role: 'roles::infra::proxmox::node'
|
|
setcode do
|
|
conf_file = '/etc/pve/corosync.conf'
|
|
totem_details = {}
|
|
in_totem_section = false
|
|
|
|
if File.exist?(conf_file)
|
|
File.foreach(conf_file) do |line|
|
|
if line =~ /^\s*totem\s*\{/
|
|
in_totem_section = true
|
|
elsif line =~ /^\s*\}/ && in_totem_section
|
|
break
|
|
elsif in_totem_section && line =~ /^\s*(\w+):\s*(.+)$/
|
|
key = Regexp.last_match(1).strip
|
|
value = Regexp.last_match(2).strip
|
|
totem_details[key] = value
|
|
end
|
|
end
|
|
end
|
|
|
|
totem_details.empty? ? nil : totem_details
|
|
end
|
|
end
|