diff options
author | Raffael Schmid <raffael@yux.ch> | 2012-02-10 16:32:16 +0100 |
---|---|---|
committer | Raffael Schmid <raffael@yux.ch> | 2012-02-10 16:32:16 +0100 |
commit | 938c06b1c4d6c77f85b05112d7312131eafbd4ec (patch) | |
tree | 1ec6ff7b64927f5b2966c3caf5cae6bce79ae1d3 /manifests/option.pp | |
parent | feac1f6d0d8174b7e2827f08d7108eaf20da33c5 (diff) |
ready for 2.7 module structure
Diffstat (limited to 'manifests/option.pp')
-rw-r--r-- | manifests/option.pp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/manifests/option.pp b/manifests/option.pp new file mode 100644 index 0000000..8c2a7a2 --- /dev/null +++ b/manifests/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 $csc { + $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; + } +} |