diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-01 23:00:13 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-01 23:00:13 +0100 |
commit | eac7bbacc7175c8c8853f431a17750bf24e3a159 (patch) | |
tree | 8830c2c331b642bf0b89b99669dd43c81c200160 /modules/nspawn/manifests/machine.pp | |
parent | Add node classifier. (diff) | |
download | webdav_server-eac7bbacc7175c8c8853f431a17750bf24e3a159.tar.gz webdav_server-eac7bbacc7175c8c8853f431a17750bf24e3a159.tar.xz |
Setup nspawn?
Diffstat (limited to 'modules/nspawn/manifests/machine.pp')
-rw-r--r-- | modules/nspawn/manifests/machine.pp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/nspawn/manifests/machine.pp b/modules/nspawn/manifests/machine.pp new file mode 100644 index 0000000..b308b74 --- /dev/null +++ b/modules/nspawn/manifests/machine.pp @@ -0,0 +1,40 @@ +define nspawn::machine ( + String $os, + String $os_version, + String $machine = $name, + Boolean $enable = false, +) { + + require ::nspawn::setup + + file { "/etc/systemd/nspawn/${machine}.nspawn": + content => @("EOF") + [Exec] + Hostname=${machine}.adrift.space + Boot=true + # /usr/lib/systemd/resolv.conf + ResolvConf=copy-static + + [Network] + Bridge=br0 + | EOF + } + + case $os { + 'debian': { + nspawn::os::debian { $machine: + os_version => $os_version, + } + } + 'arch': { + nspawn::os::arch { $machine: + } + } + # TODO default fail + } + + service { "systemd-nspawn@${machine}.service": + enable => true, + } + +} |