puppet-zookeeper icon indicating copy to clipboard operation
puppet-zookeeper copied to clipboard

Another solution to have differend zoo_id

Open rmalenko opened this issue 6 years ago • 1 comments

In manifest add something like this

case $trusted['certname'] {
    'dsp-zoo-01.domain.com': { $privateip = ['192.168.0.7/24']; $netiface ='eth1'; $zooid ='01' }
    'dsp-zoo-02.domain.com': { $privateip = ['192.168.0.7/24']; $netiface ='eth1'; $zooid ='02' }
    'dsp-zoo-03.domain.com': { $privateip = ['192.168.0.7/24']; $netiface ='eth1'; $zooid ='03' }
    default: { $privateip = '' }
  }

then

class { 'zookeeper':
  ...
  id                      => $zooid,
  ...
}

rmalenko avatar Nov 04 '19 13:11 rmalenko

Or just create a custom fact based on hostname, so say somehost001 has id 1.

Facter.add(:hostid) do
  setcode do
    Facter.value(:hostname).gsub(/[^0-9]/, '').sub!(/^0+/, "")
  end
end

ochykysh avatar Feb 06 '20 10:02 ochykysh