在一个本地节点中,使用chef-solo。我想设置3值“服务器”,但只设置最后一个值。请建议如何设置所有值? 我想在settings.xml中实现这个结果:
<servers>
<server>
<id>server1</id>
<username>user1</username>
<password>pass1</password>
</server>
<server>
<id>server2</id>
<username>user2</username>
<password>pass2</password>
</server>
<server>
<id>server3</id>
<username>user3</username>
<password>pass3</password>
</server>
</servers>
这是我的食谱:
chef_gem 'nori' do
action :install
end
chef_gem 'gyoku' do
action :install
end
include_recipe "maven"
node.default['maven']['version'] = "3.3.3"
maven_settings "settings.servers" do
value "server" => {
"id" => "server1",
"username" => "user1",
"password" => "pass1"
}
end
maven_settings "settings.servers" do
value "server" => {
"id" => "server2",
"username" => "user2",
"password" => "pass2"
}
end
maven_settings "settings.servers" do
value "server" => {
"id" => "server3",
"username" => "user3",
"password" => "pass3"
}
end
谢谢,任何建议!
答案 0 :(得分:2)
看起来您只需编辑servers
xml属性,因此根据maven cookbook自述文件,语法应如下所示:
maven_settings "settings" do
value "servers" => {
"server1" => {
"id" => "server1",
"username" => "user1",
"password" => "pass1"
},
"server2" => {
"id" => "server2",
"username" => "user2",
"password" => "pass2"
},
"server3" => {
"id" => "server3",
"username" => "user3",
"password" => "pass3"
}
}
end