aboutsummaryrefslogtreecommitdiff
path: root/manifests/kvm/manager/instance.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/kvm/manager/instance.pp')
-rw-r--r--manifests/kvm/manager/instance.pp25
1 files changed, 25 insertions, 0 deletions
diff --git a/manifests/kvm/manager/instance.pp b/manifests/kvm/manager/instance.pp
new file mode 100644
index 0000000..598e4d2
--- /dev/null
+++ b/manifests/kvm/manager/instance.pp
@@ -0,0 +1,25 @@
+class 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,
+ homedir => "/home/${name}",
+ groups => [ 'kvm' ],
+ require => Exec["kvm-creator-${name}"],
+ }
+
+ exec { "update-service-kvm-${name}":
+ comand => "/usr/sbin/update-service --add /etc/sv/kvm/${name}",
+ creates => "/etc/service/${name}",
+ require => [ Exec["kvm-creator-${name}"], User["${name}"] ],
+ }
+}