diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-06-16 13:30:38 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-06-16 13:30:38 -0300 |
commit | 2410faceba2cff819f2d58f444aa8604cf95d9fc (patch) | |
tree | 6cfcf9363b34c1b96cdfcfaba80f20070d070b0f /manifests | |
parent | 61e2ea8022db09965fd3e13304b3ad6e980278de (diff) | |
download | puppet-virtual-2410faceba2cff819f2d58f444aa8604cf95d9fc.tar.gz puppet-virtual-2410faceba2cff819f2d58f444aa8604cf95d9fc.tar.bz2 |
Initial kvm-manager support
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/kvm/manager.pp | 56 | ||||
-rw-r--r-- | manifests/kvm/manager/instance.pp | 25 |
2 files changed, 81 insertions, 0 deletions
diff --git a/manifests/kvm/manager.pp b/manifests/kvm/manager.pp new file mode 100644 index 0000000..8b2b75e --- /dev/null +++ b/manifests/kvm/manager.pp @@ -0,0 +1,56 @@ +class virtual::kvm::manager { + package { [ 'qemu-kvm', 'runit', 'uml-utilities', 'qemu-kvm', 'socat', 'bridge-utils', 'fakeroot', 'xorriso' ]: + ensure => present, + } + + vcsrepo { '/usr/local/share/kvm-manager': + ensure => present, + provider => git, + source => 'git://git.fluxo.info/kvm-manager.git', + revision => 'd8bd926096ecf6d8c38453b6752088b8a10ca3b7', + owner => 'root', + group => 'root', + } + + file { '/usr/local/sbin/di-maker': + ensure => '/usr/local/share/kvm-manager/di-maker', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvm-manager'], + } + + file { '/usr/local/sbin/kvm-manager': + ensure => '/usr/local/share/kvm-manager/kvm-manager', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvm-manager'], + } + + file { '/usr/local/sbin/kvm-creator': + ensure => '/usr/local/share/kvm-manager/kvm-creator', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvm-manager'], + } + + file { '/usr/local/sbin/kvm-status': + ensure => '/usr/local/share/kvm-manager/kvm-status', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvm-manager'], + } + + file { '/etc/screenrc.kvm-manager': + ensure => '/usr/local/share/kvm-manager/screenrc.kvm-manager', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvm-manager'], + } + + file { '/dev/kvm': + ensure => present, + owner => "root", + group => "kvm", + mode => "660", + } +} 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}"] ], + } +} |