summaryrefslogtreecommitdiff
path: root/manifests/remote_host.pp
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2012-12-31 18:51:06 +0100
committermh <mh@immerda.ch>2012-12-31 18:51:06 +0100
commit492468d87aa6ea31b137fb2361b6bf7da88f3d1d (patch)
treee7c33b8a10bc55cc8a7abce811e19c0bb247333b /manifests/remote_host.pp
parentcf80d8606ff7d4989c8b30550624b9eaa2007e73 (diff)
fully auto remote host configuration
we do not only export the certificate, but also the config snippet itself so hosts configure themself fully with an ipsec configuration.
Diffstat (limited to 'manifests/remote_host.pp')
-rw-r--r--manifests/remote_host.pp35
1 files changed, 35 insertions, 0 deletions
diff --git a/manifests/remote_host.pp b/manifests/remote_host.pp
new file mode 100644
index 0000000..6521622
--- /dev/null
+++ b/manifests/remote_host.pp
@@ -0,0 +1,35 @@
+# configure a simple remote host
+define strongswan::remote_host(
+ $right_ip_address,
+ $ensure = 'present',
+ $right_id = $name,
+ $right_cert_name = $name,
+ $right_cert_content = 'absent',
+){
+ file{"${strongswan::config_dir}/hosts/${name}.conf":
+ ensure => $ensure,
+ require => Package['strongswan'],
+ notify => Service['ipsec'],
+ }
+
+ if $ensure == 'present' {
+ File["${strongswan::config_dir}/hosts/${name}.conf"]{
+ content => template('strongswan/remote_host.erb'),
+ owner => 'root',
+ group => 0,
+ mode => '0400',
+ }
+ }
+
+ strongswan::cert{$name: }
+ if ($right_cert_content != 'absent') and ($ensure == 'present') {
+ Strongswan::Cert[$name]{
+ ensure => $ensure,
+ cert => $right_cert_content,
+ }
+ } else {
+ Strongswan::Cert[$name]{
+ ensure => 'absent',
+ }
+ }
+}