From 5381a99ba9dd9b14fe0d41aea8c1ab1b50700d6f Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 4 Jan 2013 19:13:30 +0100 Subject: deploy a helper to get all connected hosts --- manifests/base.pp | 5 +++++ manifests/init.pp | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/manifests/base.pp b/manifests/base.pp index 9f0a38e..9544102 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -20,6 +20,7 @@ class strongswan::base { mode => '0400', } + $binary_name = basename($strongswan::binary) file{ '/etc/ipsec.secrets': content => ": RSA ${::fqdn}.pem\n"; @@ -34,6 +35,10 @@ class strongswan::base { ensure => 'present'; '/etc/ipsec.conf': content => template('strongswan/ipsec.conf.erb'); + "/usr/local/sbin/${binary_name}_connected_hosts": + content => "#!/bin/bash\n${strongswan::binary} status | grep ESTABLISHED | awk -F\[ '{ print \$1 }'\n", + notify => undef, + mode => '0500'; } service{'ipsec': diff --git a/manifests/init.pp b/manifests/init.pp index 2767783..f2b3bd3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,7 +19,8 @@ class strongswan( case $::lsbmajdistrelease { '5': { $config_dir = '/etc/ipsec.d' - $cert_dir = '/etc/ipsec.d' + $cert_dir = '/etc/ipsec.d' + $binary = '/usr/sbin/ipsec' class{'strongswan::centos::five': require => Class['monkeysphere'], @@ -27,7 +28,8 @@ class strongswan( } default: { $config_dir = '/etc/strongswan' - $cert_dir = '/etc/strongswan/ipsec.d' + $cert_dir = '/etc/strongswan/ipsec.d' + $binary = '/usr/sbin/strongswan' class{'strongswan::centos::six': require => Class['monkeysphere'], } @@ -36,7 +38,8 @@ class strongswan( } default: { $config_dir = '/etc/ipsec.d' - $cert_dir = '/etc/ipsec.d' + $cert_dir = '/etc/ipsec.d' + $binary = '/usr/sbin/ipsec' class{'strongswan::base': require => Class['monkeysphere'], } -- cgit v1.2.3