eid-ops/global/overlay/etc/puppet/modules/eid/cloudimage.pp

69 lines
2.1 KiB
ObjectPascal
Raw Normal View History

# Wrapper with eduID common settings for sunet::cloudimage
define eid::cloudimage(
String $mac,
String $cpus = '1',
String $memory = '1024',
String $description = undef,
Boolean $dhcp = true,
Optional[String] $ip = undef,
Optional[String] $netmask = undef,
Optional[String] $gateway = undef,
Optional[String] $ip6 = undef,
Optional[String] $netmask6 = '64',
Optional[String] $gateway6 = undef,
Optional[Array] $resolver = undef,
Array[String] $search = ['komreg.net'],
String $bridge = 'br0',
String $size = '40G',
String $local_size = '0',
String $image_url = 'https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img',
) {
# This is a hack, use SSH keys from KVM host?
$ft_ssh_key = hiera('ssh_authorized_keys')['root_ft+4030CCAD']
$cloudimage_ssh_keys = [sprintf('%s %s %s', $ft_ssh_key['type'], $ft_ssh_key['key'], $ft_ssh_key['name'])]
$_v6_resolver = $ip6 ? {
undef => undef,
default => ['2001:6b0:1e::14',
'2001:6b0:1e::99',
],
}
$_resolver1 = pick($resolver, $_v6_resolver, 'NOT_SET')
$_resolver = $_resolver1 ? {
'NOT_SET' => undef,
default => $_resolver1,
}
$apt_proxy = safe_hiera('eid_proxy_server', undef)
sunet::cloudimage { $name:
image_url => $image_url,
ssh_keys => $cloudimage_ssh_keys,
apt_dir => '/etc/cosmos/apt',
apt_proxy => $apt_proxy,
disable_ec2 => true,
#
bridge => $bridge,
dhcp => $dhcp,
mac => $mac,
ip => $ip,
netmask => $netmask,
gateway => $gateway,
ip6 => $ip6,
netmask6 => $netmask6,
gateway6 => $gateway6,
resolver => $_resolver,
search => $search,
#
repo => $::cosmos_repo_origin_url,
tagpattern => $::cosmos_tag_pattern,
#
cpus => $cpus,
memory => $memory,
description => $description,
size => $size,
local_size => $local_size,
}
}