From 7f8c632757246813c0a9fdbf0c26ef036ff396be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 14 Aug 2018 19:23:47 +0200 Subject: Add wireguard profile --- modules/profile/manifests/wireguard.pp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 modules/profile/manifests/wireguard.pp (limited to 'modules/profile/manifests') 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 @@ +class profile::wireguard ( +) { + $password_seed = lookup("base_installation::puppet_pass_seed") + + ensure_packages(["linux-headers"], { before => Package["wireguard-dkms"] }) + ensure_packages(["wireguard-tools", "wireguard-dkms"]) + + $host = $facts["ldapvar"]["self"] + if has_key($host["vars"], "wireguard_ip") { + $ips = $host["vars"]["wireguard_ip"] + } else { + $ips = [] + } + + $private_key = generate_password(32, $password_seed, "wireguard", "curve25519", true) + + file { "/etc/wireguard/network.conf": + ensure => "file", + mode => "0600", + content => template("profile/wireguard/network.conf.erb"), + require => [Package["wireguard-tools"], Package["wireguard-dkms"]], + } + -> + service { "wg-quick@network": + ensure => "running", + enable => true, + } + +} -- cgit v1.2.3