diff options
-rw-r--r-- | global/overlay/etc/puppet/modules/sunet/manifests/cloudimage.pp | 2 | ||||
-rw-r--r-- | global/overlay/etc/puppet/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} <<EOF #cloud-config -password: ubuntu -chpasswd: { expire: False } -ssh_pwauth: True +user: root +ssh_pwauth: False ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVvB4gdJ6EWRmx8xUSxrhoUNnWxEf8ZwAqhzC1+7XBY/hSd/cbEotLB9gxgqt0CLW56VU4FPLTw8snD8tgsyZN6KH1Da7UXno8oMk8tJdwLQM0Ggx3aWuztItkDfBc3Lfvq5T07YfphqJO7rcSGbS4QQdflXuOM9JLi6NStVao0ia4aE6Tj68pVVb3++XYvqvbU6NtEICvkTxEY93YpnRSfeAi64hsbaqSTN4kpeltzoSD1Rikz2aQFtFXE03ZC48HtGGhdMFA/Ade6KWBDaXxHGARVQ9/UccfhaR2XSjVxSZ8FBNOzNsH4k9cQIb2ndkEOXZXnjF5ZjdI4ZU0F+t7 leifj+00060AD478D6@sunet.se runcmd: |