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
30
|
define virtual::kvm::instance(
$udev = false,
$shell = undef,
) {
user { $name:
ensure => present,
home => "/home/${name}",
groups => [ 'kvm' ],
shell => $shell,
}
file { [ "/home/${name}", "/home/${name}/vms", "/home/${name}/vms/${name}" ]:
ensure => directory,
owner => $name,
group => $name,
mode => '0755',
require => User[$name],
}
if $udev == true {
file { "/etc/udev/rules.d/92-kvm-${name}.rules":
ensure => present,
owner => root,
group => root,
mode => '0644',
content => template('virtual/kvm.rules.erb'),
require => User[$name],
}
}
}
|