aboutsummaryrefslogtreecommitdiff
path: root/manifests/kvm/manager/instance.pp
blob: c9ecff90709f9d5f897ca7611834f13cd81aff11 (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
define virtual::kvm::manager::instance(
  $vg,
  $size,
  $ram,
  $udev = false,
) {
  exec { "kvm-creator-${name}":
    command => "/usr/local/sbin/kvm-creator create $name $vg $size $ram",
    user    => "root",
    #creates => "/home/${name}/vms/${name}",
    creates => "/etc/sv/kvm/${name}",
  }

  exec { "update-service-kvm-${name}":
    command => "/usr/sbin/update-service --add /etc/sv/kvm/${name}",
    creates => "/etc/service/${name}",
    require => [ Exec["kvm-creator-${name}"], User["${name}"] ],
  }

  virtual::kvmx::instance { "$name":
    udev    => $udev,
    require => Exec["kvm-creator-${name}"],
  }
}