summaryrefslogtreecommitdiff
path: root/puppet/modules/openvpn/manifests/option.pp
blob: 5cadb313d149befb8310b56983ebf5096885b838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# option.pp

define openvpn::option($key, $value = "", $server, $client = "", $csc = false) {
    $content = $value ? {
        ""      => "${key}",
        default => "${key} ${value}"
    }

    if $client == "" {
        $path = "/etc/openvpn/${server}.conf"
    } else {
        if $csc {
            $path = "/etc/openvpn/${server}/client-configs/${client}"
        } else {
            $path = "/etc/openvpn/${server}/download-configs/${client}/${client}.conf"
        }
    }

    concat::fragment {
        "openvpn.${server}.${client}.${name}":
            target  => $path,
            content => "${content}\n";
    }
}