- refacter the pveceph facts - define consul services for osd, mgr, mds and mons
37 lines
1.2 KiB
Puppet
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",
|
|
script => "/usr/local/bin/check_ceph_service.sh ${key}",
|
|
interval => '10s',
|
|
timeout => '1s',
|
|
}
|
|
],
|
|
}
|
|
}
|
|
}
|
|
}
|