philroche
10/13/2017 - 3:54 PM

mk-userdata-nocloud.sh

#!/bin/bash

cat <<EOF > meta-data
instance-id: iid-local01
local-hostname: cloudimg
EOF

cat <<EOF > user-data
#cloud-config
ssh_import_id: [ yourlaunchpadid ]
system_info:
  default_user:
    lock_passwd: false
    plain_text_passwd: passw0rd
    ssh_pwauth: true
users:
  - default
EOF

genisoimage  -output seed.iso -volid cidata -joliet -rock user-data meta-data

rm user-data meta-data

echo "
Create a disk backed by the image:
qemu-img create -f qcow2 -b <orig-disk>.img boot-disk.img

Launch the instance with:
kvm -m 256 -net nic -net user,hostfwd=tcp::2222-:22 \
    -drive file=boot-disk.img,if=virtio \
    -drive file=seed.iso,if=virtio,media=cdrom"