木偶和模板:如何循环顺序,而不是随机的
查看我的节点的configuration: $property_name = { "unit_1" => { host => [ "dns_name1/192.168.0.1/25" ,"dns_name2/192.168.0.2/25" ] }, "unit_2" => { host => [ "dns_name3/192.168.0.3/25", "dns_name4/192.168.0.4/25" ] }, } include class::property 在模板中,我用了一些循环 "<% property_name.each do |key,value| -%>", "<%= value['host'][id_host].split("/")[0] %>", <%= value['host'][id_host].split("/")[1] %>, …写configuration文件。 但是,当我有很多“单位”(unit_3,unit_4等)时,每次Puppet的守护进程运行时,模板的内容都会改变。 它没有任何影响,因为configuration文件是正确的,但我想知道如果模板的循环可以生成这样的顺序的configuration文件:unit_1然后unit_2,然后unit_3,…没有采取一些单位随机。 我用这个教程: http : //www.krzywanski.net/archives/703