From 3ae2c130873f1a39c9862368ada5070cb3798e49 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Fri, 8 May 2015 16:32:24 +0200 Subject: dl image --- global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp | 7 ++++++- .../puppet/modules/sunet/templates/cloudimage/mk_cloud_image.erb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'global/overlay') diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp b/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp index a8a3bfe..feca24b 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp @@ -1,5 +1,5 @@ define sunet::cloudimage ( - $src_image = undef, + $image_url = 'https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img', $dhcp = true, $size = "1G", $bridge = "br0", @@ -20,6 +20,11 @@ define sunet::cloudimage ( package {'libvirt-bin': ensure => latest } package {'uuid-runtime': ensure => latest } + $image_url_a = split($image_url,"/") + $image_src = "/var/lib/libvirt/images/$image_url_a[-1]" + exec {"wget -O${image_src} ${image_url}": + onlyif => "test ! -f ${image_src}" + } file { "/var/lib/libvirt/cloud-init": ensure => directory } diff --git a/global/overlay/etc/puppet/modules/sunet/templates/cloudimage/mk_cloud_image.erb b/global/overlay/etc/puppet/modules/sunet/templates/cloudimage/mk_cloud_image.erb index c80a84c..447ec1f 100644 --- a/global/overlay/etc/puppet/modules/sunet/templates/cloudimage/mk_cloud_image.erb +++ b/global/overlay/etc/puppet/modules/sunet/templates/cloudimage/mk_cloud_image.erb @@ -1,6 +1,6 @@ #!/bin/bash -src_image="<%= @src_image %>" +src_image="<%= @image_src %>" size="<%= @size %>" dhcp="<%= @dhcp ? 'yes' : 'no' %>" hostname="<%= @name %>" -- cgit v1.1