]> git.openstreetmap.org Git - chef.git/commitdiff
Add support for monitoring hosts behind NAT
authorTom Hughes <tom@compton.nu>
Thu, 26 Jul 2018 10:04:42 +0000 (11:04 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 26 Jul 2018 10:04:42 +0000 (11:04 +0100)
cookbooks/networking/libraries/ipaddresses.rb
roles/rhaegal.rb

index 51ef152b52fab21ee07c891f5ccdfe48886ac6b4..d31d885f995076af73eef0d034023e4f5a97cb07 100644 (file)
@@ -4,10 +4,12 @@ class Chef
       addresses = []
 
       interfaces(options).each do |interface|
+        address = interface[:public_address] || interface[:address]
+
         if block.nil?
-          addresses << interface[:address]
+          addresses << address
         else
-          yield interface[:address]
+          yield address
         end
       end
 
index 12ccf15eba8be4310b5d44084285af83774bdff5..b29de0fa1d2efc000daae7a46c22d5962fb803d6 100644 (file)
@@ -32,7 +32,8 @@ default_attributes(
         :family => :inet,
         :address => "10.5.0.77",
         :prefix => "16",
-        :gateway => "10.5.0.1"
+        :gateway => "10.5.0.1",
+        :public_address => "161.53.248.77"
       }
     },
     :nameservers => [