summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-01-27 20:23:52 -0500
committerMicah Anderson <micah@riseup.net>2013-01-29 13:29:10 -0500
commit6ebc2b495d9ea920770823cd08ae4eb881b684f7 (patch)
tree84ebc5efb2c89f4e3d71f6bdf8e363140ec59768 /puppet/modules/site_config
parent64a3ec6ac5a064800a32170c2e8d058ab8b7dd62 (diff)
add a new fact that provides a fact for each configured ip address, telling you
which interface has it (essentially the inverse of the ipaddress_${interface} fact). Switch the hiera lookups of the $interface, which was pulling from the .json to pull instead from the above fact, see #1547 and #1548
Diffstat (limited to 'puppet/modules/site_config')
-rw-r--r--puppet/modules/site_config/lib/facter/ip_interface.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/puppet/modules/site_config/lib/facter/ip_interface.rb b/puppet/modules/site_config/lib/facter/ip_interface.rb
new file mode 100644
index 00000000..2a4a6b50
--- /dev/null
+++ b/puppet/modules/site_config/lib/facter/ip_interface.rb
@@ -0,0 +1,13 @@
+require 'facter/util/ip'
+
+Facter::Util::IP.get_interfaces.each do |interface|
+ ip = Facter.value("ipaddress_#{interface}")
+ if ip != nil
+ Facter.add(ip + "_interface" ) do
+ setcode do
+ interface
+ end
+ end
+ end
+end
+