diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-12-30 22:34:26 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-12-30 22:34:26 -0200 |
commit | 4b18be69d3635efd618deb8311c4a4fb2dd0c03e (patch) | |
tree | 510e9d7cc6c8eb3b146ad008d8863a31727b2731 | |
parent | 4a2e70edeb1d87674156cd8328352582e25d1525 (diff) | |
download | puppet-virtual-develop.tar.gz puppet-virtual-develop.tar.bz2 |
-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 | ||||
-rw-r--r-- | templates/kvm.rules.erb (renamed from templates/kvm_creator.rules.erb) | 0 |
6 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, + } +} diff --git a/templates/kvm_creator.rules.erb b/templates/kvm.rules.erb index 8267d90..8267d90 100644 --- a/templates/kvm_creator.rules.erb +++ b/templates/kvm.rules.erb |