X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/a60f8a522d3ab47b49ba10b4c5cb756e5785ef58..0aaea8096fcdd565f0f1990a84ad68e9aeb90113:/cookbooks/openssh/recipes/default.rb diff --git a/cookbooks/openssh/recipes/default.rb b/cookbooks/openssh/recipes/default.rb index 49c890b34..3349dc85d 100644 --- a/cookbooks/openssh/recipes/default.rb +++ b/cookbooks/openssh/recipes/default.rb @@ -29,15 +29,16 @@ service "ssh" do end hosts = search(:node, "networking:interfaces").sort_by { |n| n[:hostname] }.collect do |node| - names = [node[:hostname]] + name = node.name.split(".").first - node.interfaces(:role => :external).each do |interface| - names |= ["#{node[:hostname]}.openstreetmap.org"] - names |= ["#{node[:hostname]}.#{interface[:zone]}.openstreetmap.org"] - end + names = [name] unless node.interfaces(:role => :internal).empty? - names |= ["#{node[:hostname]}.#{node[:networking][:roles][:external][:zone]}.openstreetmap.org"] + names.unshift("#{name}.#{node[:networking][:roles][:external][:zone]}.openstreetmap.org") + end + + unless node.interfaces(:role => :external).empty? + names.unshift("#{name}.openstreetmap.org") end keys = { @@ -56,7 +57,7 @@ hosts = search(:node, "networking:interfaces").sort_by { |n| n[:hostname] }.coll end Hash[ - :names => names.sort, + :names => names, :addresses => node.ipaddresses.sort, :keys => keys ]