- set the consul services for ceph mon, mds, mgr and osd to report the ceph cluster interface
39 lines
1.3 KiB
Puppet
39 lines
1.3 KiB
Puppet
# profiles::proxmox::consul
|
|
class profiles::proxmox::consul (
|
|
String $ceph_network_interface = 'vmbr1',
|
|
) {
|
|
|
|
$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']['interfaces'][$ceph_network_interface]['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',
|
|
}
|
|
],
|
|
}
|
|
}
|
|
}
|
|
}
|