ae256b7c0b
ci/woodpecker/pr/erb-validate Pipeline was successful
ci/woodpecker/pr/ruby-validate Pipeline was successful
ci/woodpecker/pr/puppet-lint Pipeline was successful
ci/woodpecker/pr/yamllint Pipeline was successful
ci/woodpecker/pr/bolt-validate Pipeline was successful
ci/woodpecker/pr/epp-validate Pipeline was successful
ci/woodpecker/pr/puppet-validate Pipeline was successful
ci/woodpecker/pr/ruby-check Pipeline was successful
Replace deprecated dalen-puppetdbquery module with native puppetdb_query function using PQL syntax to resolve URI.escape compatibility issues. This is required to migrated to Puppet 8 (and kubernetes). Changes: - Remove dalen-puppetdbquery dependency from Puppetfile - Replace query_nodes() calls with puppetdb_query() using PQL syntax - Update 27 function calls across 18 Puppet manifests - Maintain equivalent functionality with improved compatibility
45 lines
1.4 KiB
Puppet
45 lines
1.4 KiB
Puppet
# profiles::proxmox::clusterinit
|
|
class profiles::proxmox::clusterinit {
|
|
|
|
# include params class
|
|
include profiles::proxmox::params
|
|
|
|
# localise some vars
|
|
$clusterinit_master = $profiles::proxmox::params::pve_clusterinit_master
|
|
$clustername = $profiles::proxmox::params::pve_cluster
|
|
$membersrole = $profiles::proxmox::params::pve_members_role
|
|
|
|
# if this is the cluster master
|
|
if $clusterinit_master {
|
|
|
|
# and its not a member of a cluster yet
|
|
if ! $facts['pve_cluster_member'] {
|
|
|
|
# initialise a cluster
|
|
exec {'pve_init_cluster':
|
|
command => "/usr/bin/pvecm create ${clustername}",
|
|
unless => 'pvecm status',
|
|
timeout => 60,
|
|
}
|
|
}
|
|
}
|
|
|
|
$servers_array = sort(puppetdb_query(
|
|
"facts[certname] {
|
|
name = 'enc_role' and value = '${membersrole}' and
|
|
certname in facts[certname] { name = 'country' and value = '${facts['country']}' } and
|
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
|
}"
|
|
).map |$fact| { $fact['certname'] })
|
|
|
|
if ! $profiles::proxmox::params::pve_clusterinit_master {
|
|
if !empty($servers_array) {
|
|
notify { "Cluster ${profiles::proxmox::params::pve_cluster} detected, proceeding to join...":
|
|
}
|
|
} else {
|
|
notify { "No cluster flag found for ${profiles::proxmox::params::pve_cluster}, not attempting to join":
|
|
}
|
|
}
|
|
}
|
|
}
|