diff options
Diffstat (limited to 'manifests/kvm/kvmx/instance.pp')
-rw-r--r-- | manifests/kvm/kvmx/instance.pp | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/manifests/kvm/kvmx/instance.pp b/manifests/kvm/kvmx/instance.pp index b0b30ba..dd6cdb6 100644 --- a/manifests/kvm/kvmx/instance.pp +++ b/manifests/kvm/kvmx/instance.pp @@ -4,8 +4,15 @@ define virtual::kvm::kvmx::instance( $ram, $shell, $iface, - $udev = false, - $supervise = '1', + $ip, + $gateway, + $guest_domain = 'example.org', + $dns = 'host', + $netmask = '255.255.255.0', + $initial_user = 'user', + $udev = false, + $supervise = '1', + $ssh_custom_pubkey = '', ) { virtual::kvm::instance { $name: udev => $udev, @@ -21,6 +28,7 @@ define virtual::kvm::kvmx::instance( user => root, creates => "/dev/${vg}/${name}", #onlyif => "test ! -e /dev/${vg}/${name}" + require => Virtual::Kvm::Instance["$name"], # due to udev rule } exec { "kvmx-init-${name}": @@ -32,6 +40,12 @@ define virtual::kvm::kvmx::instance( require => Virtual::Kvm::Instance["$name"], } + virtual::kvm::kvmx::config { "${name}-user": + vm => $name, + param => 'user', + value => $initial_user, + } + virtual::kvm::kvmx::config { "${name}-memory": vm => $name, param => 'memory', @@ -56,6 +70,36 @@ define virtual::kvm::kvmx::instance( value => "tap", } + virtual::kvm::kvmx::config { "${name}-net_ip": + vm => $name, + param => 'net_ip', + value => "$ip", + } + + virtual::kvm::kvmx::config { "${name}-net_mask": + vm => $name, + param => 'net_mask', + value => "$netmask", + } + + virtual::kvm::kvmx::config { "${name}-net_gateway": + vm => $name, + param => 'net_gateway', + value => "$gateway", + } + + virtual::kvm::kvmx::config { "${name}-net_dns": + vm => $name, + param => 'net_dns', + value => "$dns", + } + + virtual::kvm::kvmx::config { "${name}-domain": + vm => $name, + param => 'domain', + value => "$guest_domain", + } + virtual::kvm::kvmx::config { "${name}-spice": vm => $name, param => 'spice', @@ -91,6 +135,12 @@ define virtual::kvm::kvmx::instance( value => "raw", } + virtual::kvm::kvmx::config { "${name}-image_type": + vm => $name, + param => 'image_type', + value => "device", + } + virtual::kvm::kvmx::config { "${name}-ssh_support": vm => $name, param => 'ssh_support', @@ -108,4 +158,18 @@ define virtual::kvm::kvmx::instance( param => 'supervise_manage', value => "${supervise}", } + + if $ssh_custom_pubkey == '' { + virtual::kvm::kvmx::config_unset { "${name}-ssh_custom_pubkey": + vm => $name, + param => 'ssh_custom_pubkey', + } + } + else { + virtual::kvm::kvmx::config { "${name}-ssh-custom_pubkey": + vm => $name, + param => 'ssh_custom_pubkey', + value => $ssh_custom_pubkey, + } + } } |