diff options
author | mh <mh@immerda.ch> | 2013-01-03 18:31:05 +0100 |
---|---|---|
committer | mh <mh@immerda.ch> | 2013-01-03 18:31:05 +0100 |
commit | 5ce46c56e0ed95e03c3322f6eba53488a0615207 (patch) | |
tree | ee2226bad8fb7110d0259b021710cafcaf5cb8fe /lib/facter/strongswan_ips.rb | |
parent | 19faa5112c736788ac0ad73eaad8009267be0ad0 (diff) |
automatically configure a subnet for all listening ips
Diffstat (limited to 'lib/facter/strongswan_ips.rb')
-rw-r--r-- | lib/facter/strongswan_ips.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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 |