diff options
Diffstat (limited to 'modules/profile/manifests')
-rw-r--r-- | modules/profile/manifests/wireguard.pp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/profile/manifests/wireguard.pp b/modules/profile/manifests/wireguard.pp new file mode 100644 index 0000000..ad1b081 --- /dev/null +++ b/modules/profile/manifests/wireguard.pp | |||
@@ -0,0 +1,29 @@ | |||
1 | class profile::wireguard ( | ||
2 | ) { | ||
3 | $password_seed = lookup("base_installation::puppet_pass_seed") | ||
4 | |||
5 | ensure_packages(["linux-headers"], { before => Package["wireguard-dkms"] }) | ||
6 | ensure_packages(["wireguard-tools", "wireguard-dkms"]) | ||
7 | |||
8 | $host = $facts["ldapvar"]["self"] | ||
9 | if has_key($host["vars"], "wireguard_ip") { | ||
10 | $ips = $host["vars"]["wireguard_ip"] | ||
11 | } else { | ||
12 | $ips = [] | ||
13 | } | ||
14 | |||
15 | $private_key = generate_password(32, $password_seed, "wireguard", "curve25519", true) | ||
16 | |||
17 | file { "/etc/wireguard/network.conf": | ||
18 | ensure => "file", | ||
19 | mode => "0600", | ||
20 | content => template("profile/wireguard/network.conf.erb"), | ||
21 | require => [Package["wireguard-tools"], Package["wireguard-dkms"]], | ||
22 | } | ||
23 | -> | ||
24 | service { "wg-quick@network": | ||
25 | ensure => "running", | ||
26 | enable => true, | ||
27 | } | ||
28 | |||
29 | } | ||