From db67305282bec64dfe081099b14697adc83ebb02 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Sat, 9 May 2015 16:33:00 +0200 Subject: force ssh key on root --- .../overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp | 2 +- .../modules/sunet/templates/cloudimage/mk_cloud_image.erb | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp b/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp index fa4caf9..d6400d7 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp @@ -32,7 +32,7 @@ define sunet::cloudimage ( content => template("sunet/cloudimage/mk_cloud_image.erb"), mode => "0755" } -> - exec { "/var/lib/libvirt/images/${name}/${name}-init.sh >/var/log/${hostname}-init.log 2>&1": + exec { "/var/lib/libvirt/images/${name}/${name}-init.sh": onlyif => "test ! -f /var/lib/libvirt/images/${name}/${name}.img" } } 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 2f76078..13c4f17 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 @@ -18,6 +18,7 @@ resolver="<%= @resolver %>" ip6="<%= @ip6 %>" gateway6="<%= @gateway6 %>" netmask6="<%= @netmask6 %>" +password="<%= @password %>" cd "/var/lib/libvirt/cloud-init" @@ -31,12 +32,15 @@ rm -f ${seed} truncate --size 2M ${seed} mkfs.vfat -n cidata ${seed} 2>/dev/null +if [ "x${password}" != "x" ]; then + pass="password: ${password}" +fi + user_data=$(mktemp) cat > ${user_data} <