我有3种不同的方式来安装所述包,我最喜欢选项#1,但我想看看是否有理由使用选项#2或3或任何其他选项? (我这个问题的目标是获得不同方法的反馈;如果可能的话,不要在编译时安装……在这种情况下)
1.
p = package "snmp" do package_name value_for_platform( [ "centos","redhat","suse" ] => { "default" => "net-snmp" },"default" => "snmpd" ) action :install end
第2位.
packages = case node[:platform] when "centos","fedora" %w{net-snmp} else %w{snmpd} end packages.each do |pkg| package pkg end
3.
package "snmpd" do action :install only_if do platform?("ubuntu","debian") end end