diff options
Diffstat (limited to 'manifests/kvm')
-rw-r--r-- | manifests/kvm/instance.pp | 19 | ||||
-rw-r--r-- | manifests/kvm/kvmx.pp | 41 | ||||
-rw-r--r-- | manifests/kvm/manager.pp | 13 | ||||
-rw-r--r-- | manifests/kvm/manager/instance.pp | 18 | ||||
-rw-r--r-- | manifests/kvm/packages.pp | 15 |
5 files changed, 80 insertions, 26 deletions
diff --git a/manifests/kvm/instance.pp b/manifests/kvm/instance.pp new file mode 100644 index 0000000..57e3bf0 --- /dev/null +++ b/manifests/kvm/instance.pp @@ -0,0 +1,19 @@ +define virtual::kvm::instance( + $udev = false, +) { + user { $name: + ensure => present, + home => "/home/${name}", + groups => [ 'kvm' ], + } + + 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'), + } + } +} diff --git a/manifests/kvm/kvmx.pp b/manifests/kvm/kvmx.pp new file mode 100644 index 0000000..daed3d6 --- /dev/null +++ b/manifests/kvm/kvmx.pp @@ -0,0 +1,41 @@ +class virtual::kvm::kvmx { + include virtual::kvm::packages + include virtual::networking + + vcsrepo { '/usr/local/share/kvmx': + ensure => present, + provider => git, + source => 'https://git.fluxo.info/kvmx', + revision => 'd2263b94f93e0c0b7549c5a84c18834f8e6e8f58', + owner => 'root', + group => 'root', + } + + file { '/usr/local/bin/kvmx': + ensure => '/usr/local/share/kvmx/kvmx', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvmx'], + } + + file { '/usr/local/bin/kvmx-create': + ensure => '/usr/local/share/kvmx/kvmx-create', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvmx'], + } + + file { '/usr/local/bin/kvmx-status': + ensure => '/usr/local/share/kvmx/kvmx-status', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvmx'], + } + + file { '/usr/local/bin/kvmx-vdagent': + ensure => '/usr/local/share/kvmx/kvmx-vdagent', + owner => 'root', + group => 'root', + require => Vcsrepo['/usr/local/share/kvmx'], + } +} diff --git a/manifests/kvm/manager.pp b/manifests/kvm/manager.pp index 5c9b2fb..daed51e 100644 --- a/manifests/kvm/manager.pp +++ b/manifests/kvm/manager.pp @@ -1,28 +1,19 @@ class virtual::kvm::manager { + include virtual::kvm::packages include virtual::networking package { [ - 'qemu-kvm', 'runit', 'runit-systemd', 'uml-utilities', - 'qemu-kvm', - 'socat', - 'fakeroot', - 'xorriso', ]: ensure => present, } - # Provide a netboot image for VM installs - package { "debian-installer-9-netboot-${::architecture}": - ensure => present, - } - vcsrepo { '/usr/local/share/kvm-manager': ensure => present, provider => git, - source => 'git://git.fluxo.info/kvm-manager.git', + source => 'https://git.fluxo.info/kvm-manager', revision => 'b262c9597a3c5fd8c86ae63deda10f999048dfb8', owner => 'root', group => 'root', diff --git a/manifests/kvm/manager/instance.pp b/manifests/kvm/manager/instance.pp index 621a3ca..c9ecff9 100644 --- a/manifests/kvm/manager/instance.pp +++ b/manifests/kvm/manager/instance.pp @@ -11,26 +11,14 @@ define virtual::kvm::manager::instance( 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}"] ], } - if $udev == true { - file { "/etc/udev/rules.d/92-kvm_creator-${name}.rules": - ensure => present, - owner => root, - group => root, - mode => '0644', - content => template('virtual/kvm_creator.rules.erb'), - } + virtual::kvmx::instance { "$name": + udev => $udev, + require => Exec["kvm-creator-${name}"], } } diff --git a/manifests/kvm/packages.pp b/manifests/kvm/packages.pp new file mode 100644 index 0000000..3505e7f --- /dev/null +++ b/manifests/kvm/packages.pp @@ -0,0 +1,15 @@ +class virtual::kvm::packages { + package { [ + 'qemu-kvm', + 'socat', + 'fakeroot', + 'xorriso', + ]: + ensure => present, + } + + # Provide a netboot image for VM installs + package { "debian-installer-9-netboot-${::architecture}": + ensure => present, + } +} |