summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2013-01-04 19:13:30 +0100
committermh <mh@immerda.ch>2013-01-04 19:13:30 +0100
commit5381a99ba9dd9b14fe0d41aea8c1ab1b50700d6f (patch)
tree387e3570ba14a158dadc539ca17315fa34fec59c
parent86c536e48d4f01762905fae47e10705d8e80e112 (diff)
deploy a helper to get all connected hosts
-rw-r--r--manifests/base.pp5
-rw-r--r--manifests/init.pp9
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'],
}