From 5ce46c56e0ed95e03c3322f6eba53488a0615207 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 3 Jan 2013 18:31:05 +0100 Subject: automatically configure a subnet for all listening ips --- lib/facter/strongswan_ips.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/facter/strongswan_ips.rb (limited to 'lib') diff --git a/lib/facter/strongswan_ips.rb b/lib/facter/strongswan_ips.rb new file mode 100644 index 0000000..7d6f30b --- /dev/null +++ b/lib/facter/strongswan_ips.rb @@ -0,0 +1,10 @@ +Facter.add("strongswan_ips") do + setcode do + result = nil + if bin = ['/usr/sbin/ipsec', '/usr/sbin/strongswan'].find{|f| File.exists?(f) } + output = Facter::Util::Resolution.exec("#{bin} statusall | grep -E '^ [0-9a-f]'").split("\n").collect(&:strip) + result = output.join(',') unless output.empty? + end + result + end +end -- cgit v1.2.3