aboutsummaryrefslogtreecommitdiff
path: root/manifests/kvm/manager/instance.pp
blob: 4f523101c3f978616aa7d4c8387ade7f9d111f90 (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
define virtual::kvm::manager::instance(
  $vg,
  $size,
  $ram,
) {
  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}",
  }

  user { $name:
    ensure  => present,
    home    => "/home/${name}",
    groups  => [ 'kvm' ],
    require => Exec["kvm-creator-${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}"] ],
  }
}