Commit 64168e28 authored by Your Name's avatar Your Name
Browse files

p9

parent 77c862e8
......@@ -6,6 +6,8 @@ define hypervisor::vm::deploy (
$ensure = 'present',
String $domain = lookup('domain', undef, undef, 'nodomainset.la'),
Stdlib::Fqdn $public_hostname = "${name}.${domain}",
String $devices_profile = 'headless',
String $dom_profile = 'myprofile',
String $rootsize = '4G',
String $swapsize = '1G',
Boolean $datadisk = false,
......@@ -146,17 +148,31 @@ define hypervisor::vm::deploy (
}
file { "/etc/libvirt/qemu/${name}.xml":
audit => 'content',
notify => Exec["restart_${name}"],
audit => 'content',
notify => Exec["restart_${name}"],
}
$devices = undef
$disk = undef
if "${devices_profile}" == 'p9' {
libvirt::domain { $name:
devices_profile => 'headless',
dom_profile => 'myprofile',
boot => 'hd',
disks => hypervisor_disks($name,$hypervisor::vm::root_vg,$hypervisor::vm::swap_vg,$hypervisor::vm::data_vg,$datadisk),
interfaces => hypervisor_interfaces($name,$internal_ip,$internal_mac,$external_ip,$external_mac,$external_net,$internal_method,$external_method),
autostart => $autostart,
mount { "/srv/rootfs/${name}":
ensure => 'mounted',
device => "/dev/${hypervisor::vm::root_vg}/${name}-disk"
}
$devices = { "filesystem" => { "values" => { "source" => { "attrs" => { "dir" => "/srv/rootfs/${name}" }}}} }
} else {
$disks = hypervisor_disks($name,$hypervisor::vm::root_vg,$hypervisor::vm::swap_vg,$hypervisor::vm::data_vg,$datadisk)
}
libvirt::domain { $name:
devices_profile => $devices_profile,
dom_profile => $dom_profile,
devices => $devices,
disks => $disks,
#boot => 'hd',
interfaces => hypervisor_interfaces($name,$internal_ip,$internal_mac,$external_ip,$external_mac,$external_net,$internal_method,$external_method),
autostart => $autostart,
require => [ Exec["/usr/local/bin/mkrootdisk.sh /dev/${hypervisor::vm::root_vg}/${name}-disk"],
Exec["delete old ${name} config"],
#hypervisor::network["${internal_net}"],
......
......@@ -4,6 +4,12 @@
class hypervisor::vms (
String $domain = lookup('domain', undef, undef, 'no_domain_set'),
$vm_defaults = {
devices_profile => 'headless',
dom_profile => 'myprofile',
}
) {
......@@ -22,9 +28,18 @@ class hypervisor::vms (
kernel_type => 'debian',
}
# create vm's defined in hiera
# create vm's defined in hiera
$vms = hiera_hash('vms')
create_resources ( hypervisor::vm::deploy , $vms )
$vms.each |String $resource, Hash $attributes| {
Resource["hypervisor::vm::deploy"] {
$resource: * => $attributes;
default: * => $vm_defaults;
}
}
#create_resources ( hypervisor::vm::deploy , $vms )
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment