On Tue, Dec 13, 2011 at 12:07:46PM -0200, Wagner Sartori Junior wrote:
> Hi,
> I have a hash variable defined on a node:
> � � � � $vips = {
> � � � � � � � � wha => {
> � � � � � � � � � � � � '[1]vip1.mycompany.net' => {
> � � � � � � � � � � � � � � � � name => '[2]wha.mycompany.net',
> � � � � � � � � � � � � � � � � vip => '10.4.229.132',
> � � � � � � � � � � � � � � � � certificate_name =>
> '[3]wha.mycompany.net',
> � � � � � � � � � � � � },
> � � � � � � � � � � � � '[4]vip2.mycompany.net' => {
> � � � � � � � � � � � � � � � � name => '[5]wha.mycompany.com',
> � � � � � � � � � � � � � � � � vip => '10.4.229.136',
> � � � � � � � � � � � � � � � � certificate_name =>
> '[6]wha.mycompany.com',
> � � � � � � � � � � � � },
> � � � � � � � � � � � � ... # I have around 15 VIP's on each node
> � � � � � � � },
> On my template I have:
> <% vips.each_pair do |system, system_values| -%>
> <% if system == "wha" then -%>
> <% system_values.each_pair do |server_name, server_name_values| -%>
> #<%= server_name_values['name'] %>
> <% if server_name_values.has_key?("certificate_name") -%>
> Listen <%= server_name_values['vip'] %>:80
> Listen <%= server_name_values['vip'] %>:443
> <% else -%>
> Listen <%= server_name_values['vip'] %>:80
> <% end -%><% end -%><% end -%><% end -%>
> My file on the servers keeps changing on each puppet run. The HASH
> variable order is what changes from one run to another(first run it
> defines [7]wha.mycompany.net first on second run it defines
> [8]wha.mycompany.com first).
> Is this a bug or I'm doing something stupid here?
Sort every time you loop over hash keys (I use this solution). Alternatively,
consider storing a list of lists.
> Thanks,
> Wagner Sartori Junior
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
> References
>
> Visible links
> 1. http://vip1.mycompany.net/
> 2. http://wha.mycompany.net/
> 3. http://wha.mycompany.net/
> 4. http://vip2.mycompany.net/
> 5. http://wha.mycompany.com/
> 6. http://wha.mycompany.com/
> 7. http://wha.mycompany.net/
> 8. http://wha.mycompany.com/
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.