Sort logstash server firewall rules by node name
authorTom Hughes <tom@compton.nu>
Sun, 16 Oct 2016 20:43:07 +0000 (21:43 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 16 Oct 2016 20:50:39 +0000 (21:50 +0100)
cookbooks/logstash/recipes/default.rb

index cf8405f..3f2c98f 100644 (file)
@@ -66,7 +66,7 @@ end
 
 forwarders = search(:node, "recipes:logstash\\:\\:forwarder") # ~FC010
 
-forwarders.each do |forwarder|
+forwarders.sort_by { |n| n[:fqdn] }.each do |forwarder|
   forwarder.interfaces(:role => :external) do |interface|
     firewall_rule "accept-lumberjack-#{forwarder}" do
       action :accept
@@ -82,7 +82,7 @@ end
 
 gateways = search(:node, "roles:gateway") # ~FC010
 
-gateways.each do |gateway|
+gateways.sort_by { |n| n[:fqdn] }.each do |gateway|
   gateway.interfaces(:role => :external) do |interface|
     firewall_rule "accept-lumberjack-#{gateway}" do
       action :accept