문제

i 꼭두각시를 사용하여 슬레이브 데이터베이스 중에 구성을 표준화하면 MySQL의 My.cnf 템플리지가 삽입되었습니다.지금, 나는 InnoDB 설정을 목표로 삼고 있습니다. 메모리, 디스크 및 PROCS와 같은 하드웨어 사양과 같은 하드웨어 사양에 대해 안전하게 계산할 수있는 구성 옵션이 있습니까?

도움이 되었습니까?

해결책

You need facter.

puppet:/etc/puppet/modules/master/lib/facter$ cat disks.rb
#!/usr/bin/ruby
#require 'facter'

mount = `/bin/mount`
disks=Array.new 
mount.split("\n").each_with_index { | disk,i |
  unless disk.scan(/ext3|simfs|reiserfs|xfs/).empty?
    d=disk.split[2]
    disks.push d
    disks.push ','
 end
}

Facter.add('disks') do
 setcode do
   disks
 end 
end 

` and in puppet.pp i use facts $disks

#add disk check to zabbix
exec { "create_host":
    command => "/bin/echo $fqdn $ipaddress $disks | do_work",
    require => File["/root/ticket"],
    subscribe => File["/root/ticket"],
    refreshonly => true,
}

see "Adding Custom Facts to Facter" on puppet labs.

다른 팁

I'd be tempted to move the calculations into the erb file, for example the key_buffer_size is recommended to be set to 1/4 of the Systems RAM:

set-variable = key_buffer_size=<%= (memorysize.split(' ')[0].to_i * 1024) / 4 -%>M

there is no reason why you couldn't work on other variables available from Facter (number of processors etc) and come up with your own calculations to set other variables as above.

Remember ERB effectively provides a subset of Ruby so almost anything you can do in Ruby can be done in ERB.

puppet have the erb template, erb template can use the facter value ,like hostname or memor. and you can write you self facter shell script.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top