summaryrefslogtreecommitdiff
path: root/modules/nspawn/manifests/machine.pp
blob: d747069ec43895884564966fcca2dd4b8c43885b (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
25
26
27
28
29
define nspawn::machine (
  String $os,
  Hash $os_opts = {} ,
  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
  }

  create_resources("nspawn::os::${os}", { $machine => $os_opts })

  service { "systemd-nspawn@${machine}.service":
    enable => true,
  }

}