summaryrefslogtreecommitdiff
path: root/puppet/modules/openvpn/manifests/option.pp
blob: eb3d5a72ee6d1b7bf2f6fe1d9ee9abe46b00044a (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, $server, $value = '', $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";
    }
}