summaryrefslogtreecommitdiff
path: root/manifests/definitions/option.pp
diff options
context:
space:
mode:
authorRaffael Schmid <raffael@yux.ch>2011-08-12 10:13:29 +0200
committerRaffael Schmid <raffael@yux.ch>2011-08-12 10:13:29 +0200
commit55b874ebf13d218437f3edd7002d2ff41c7ef457 (patch)
treea332d937abdd140afeb55327801c60fbaa5832c4 /manifests/definitions/option.pp
parent6f70eb67b81492406f3955b16a992ac29085a1ec (diff)
add module content
Diffstat (limited to 'manifests/definitions/option.pp')
-rw-r--r--manifests/definitions/option.pp31
1 files changed, 31 insertions, 0 deletions
diff --git a/manifests/definitions/option.pp b/manifests/definitions/option.pp
new file mode 100644
index 0000000..6c694d4
--- /dev/null
+++ b/manifests/definitions/option.pp
@@ -0,0 +1,31 @@
+# option.pp
+
+define openvpn::option($ensure = present, $key, $value = "", $server, $client = "", $csc = false) {
+ $content = $value ? {
+ "" => "${key}",
+ default => "${key} ${value}"
+ }
+
+ if $client == "" {
+ $path = "/etc/openvpn/${server}.conf"
+ $req = File["/etc/openvpn"]
+ $notify = Service["openvpn"]
+ } else {
+ if $scs {
+ $path = "/etc/openvpn/${server}/client-configs/${client}"
+ } else {
+ $path = "/etc/openvpn/${server}/download-configs/${client}/${client}.conf"
+ }
+ $req = [ File["/etc/openvpn"], File["/etc/openvpn/${server}/download-configs/${client}"] ]
+ $notify = undef
+ }
+
+ common::concatfilepart {
+ "${name}":
+ ensure => $ensure,
+ file => $path,
+ content => "${content}\n",
+ notify => $notify,
+ require => $req;
+ }
+}