summaryrefslogtreecommitdiff
path: root/manifests/machine.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/machine.pp')
-rw-r--r--manifests/machine.pp40
1 files changed, 40 insertions, 0 deletions
diff --git a/manifests/machine.pp b/manifests/machine.pp
new file mode 100644
index 0000000..b308b74
--- /dev/null
+++ b/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,
+ }
+
+}