puppet-prod/site/profiles/manifests/proxmox/consul.pp
Ben Vincent a3ef535bfc fix: ceph consul check script
- add permissions to write ceph-* services to consul
- change from `script` to `args` array
2024-06-19 22:36:04 +10:00

37 lines
1.2 KiB
Puppet

# profiles::proxmox::consul
class profiles::proxmox::consul {
$services = {
'mon' => { 'port' => 6789, 'service_name' => 'ceph-mon', 'fact' => 'is_pveceph_mon' },
'osd' => { 'port' => 6800, 'service_name' => 'ceph-osd', 'fact' => 'is_pveceph_osd' },
'mds' => { 'port' => 6800, 'service_name' => 'ceph-mds', 'fact' => 'is_pveceph_mds' },
'mgr' => { 'port' => 9283, 'service_name' => 'ceph-mgr', 'fact' => 'is_pveceph_mgr' },
}
file { '/usr/local/bin/check_ceph_service.sh':
ensure => file,
mode => '0755',
content => template('profiles/proxmox/check_ceph_service.sh.erb'),
}
$services.each |$key, $value| {
if $facts[$value['fact']] {
consul::service { "ceph-${key}":
service_name => $value['service_name'],
tags => ['proxmox', 'ceph', $key],
address => $facts['networking']['ip'],
port => $value['port'],
checks => [
{
id => "pveceph_${key}_check",
name => "PVECeph ${key} Check",
args => ['/usr/local/bin/check_ceph_service.sh', $key],
interval => '10s',
timeout => '1s',
}
],
}
}
}
}