puppet 中在site.pp中调用module中某个方法
因为class中的参数不能动态变化,当需要给配置文件动态加某些内容时,在init.pp中定义函数,然后在site.pp中调用,就可以动态加某些内容eg:
在site.pp中:
addmon::addmonitor{"lbnode02":
hostname => "shlbnode02",
host_ip => "10.239.19.147",
template => "shlbnode.erb",
poller_tag => "loc",
require => ],
}
在init.pp中
class addmon{
require shinken
}
define addmon::addmonitor($hostname,$host_ip,$template,$poller_tag){
....
}
页:
[1]