aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-11 12:27:35 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-11 12:27:35 -0300
commita324c9c0840733903f45c5baaf05ba9388d6237b (patch)
treeaa4f0a94d041f000649f2bec654bef0a7b1ef4f1
parent5ca1af4c74c9bde2a9e2c14e1bd54c4899ddf5f5 (diff)
downloadpuppet-virtual-a324c9c0840733903f45c5baaf05ba9388d6237b.tar.gz
puppet-virtual-a324c9c0840733903f45c5baaf05ba9388d6237b.tar.bz2
KVMX: custom config for servers
-rw-r--r--manifests/kvm/kvmx.pp2
-rw-r--r--manifests/kvm/kvmx/config_unset.pp13
-rw-r--r--manifests/kvm/kvmx/instance.pp62
3 files changed, 75 insertions, 2 deletions
diff --git a/manifests/kvm/kvmx.pp b/manifests/kvm/kvmx.pp
index b715a7c..0818103 100644
--- a/manifests/kvm/kvmx.pp
+++ b/manifests/kvm/kvmx.pp
@@ -6,7 +6,7 @@ class virtual::kvm::kvmx {
ensure => present,
provider => git,
source => 'https://git.fluxo.info/kvmx',
- revision => '684ca29524749320e0dfa0aa331bf105e2e5379f',
+ revision => '8356c30791a582ffc357a5522cc5ec9e6c7140a2',
owner => 'root',
group => 'root',
}
diff --git a/manifests/kvm/kvmx/config_unset.pp b/manifests/kvm/kvmx/config_unset.pp
new file mode 100644
index 0000000..978dca5
--- /dev/null
+++ b/manifests/kvm/kvmx/config_unset.pp
@@ -0,0 +1,13 @@
+define virtual::kvm::kvmx::config_unset(
+ $vm,
+ $param,
+) {
+ exec { "kvmx-config-${vm}-${param}":
+ command => "/usr/local/bin/kvmx config_unset ${param}",
+ user => $vm,
+ environment => [ "HOME=/home/${vm}" ],
+ cwd => "/home/${vm}/vms/${vm}",
+ onlyif => "/bin/grep ^${param}= /home/${vm}/vms/${vm}/kvmxfile",
+ require => Exec["kvmx-init-${vm}"],
+ }
+}
diff --git a/manifests/kvm/kvmx/instance.pp b/manifests/kvm/kvmx/instance.pp
index 6b19f3a..c8c7d31 100644
--- a/manifests/kvm/kvmx/instance.pp
+++ b/manifests/kvm/kvmx/instance.pp
@@ -3,7 +3,8 @@ define virtual::kvm::kvmx::instance(
$size,
$ram,
$shell,
- $udev = false,
+ $udev = false,
+ $supervise = 1,
) {
virtual::kvm::instance { $name:
udev => $udev,
@@ -46,4 +47,63 @@ define virtual::kvm::kvmx::instance(
param => 'image',
value => "\$HOME/vms/${name}/box.img",
}
+
+ virtual::kvm::kvmx::config { "${name}-net":
+ vm => $name,
+ param => 'net',
+ value => "tap",
+ }
+
+ virtual::kvm::kvmx::config { "${name}-spice":
+ vm => $name,
+ param => 'spice',
+ value => "0",
+ }
+
+ virtual::kvm::kvmx::config { "${name}-run_spice_client":
+ vm => $name,
+ param => 'run_spice_client',
+ value => "0",
+ }
+
+ virtual::kvm::kvmx::config { "${name}-graphics":
+ vm => $name,
+ param => 'graphics',
+ value => "-nographic",
+ }
+
+ virtual::kvm::kvmx::config { "${name}-sound":
+ vm => $name,
+ param => 'sound',
+ value => "0",
+ }
+
+ virtual::kvm::kvmx::config_unset { "${name}-shared_folder":
+ vm => $name,
+ param => 'shared_folder',
+ }
+
+ virtual::kvm::kvmx::config { "${name}-format":
+ vm => $name,
+ param => 'format',
+ value => "raw",
+ }
+
+ virtual::kvm::kvmx::config { "${name}-ssh_support":
+ vm => $name,
+ param => 'ssh_support',
+ value => "n",
+ }
+
+ virtual::kvm::kvmx::config { "${name}-drive_interface":
+ vm => $name,
+ param => 'drive_interface',
+ value => "virtio,cache=none,index=0,format=raw",
+ }
+
+ virtual::kvm::kvmx::config { "${name}-supervise_manage":
+ vm => $name,
+ param => 'supervise_manage',
+ value => "${supervise}",
+ }
}