Skip to content

Instantly share code, notes, and snippets.

@toabctl
Created November 22, 2017 09:17
Show Gist options
  • Save toabctl/a810913e77f93aac111be96d3146e3b6 to your computer and use it in GitHub Desktop.
Save toabctl/a810913e77f93aac111be96d3146e3b6 to your computer and use it in GitHub Desktop.
Create a config drive iso for cloud-init
cat <<EOF > user-data
#cloud-config
debug: True
disable_root: False
ssh_deletekeys: False
ssh_pwauth: True
ssh_authorized_keys:
- ssh-rsa XXX
# users:
# - name: clouduser
# gecos: User
# sudo: ["ALL=(ALL) NOPASSWD:ALL"]
# groups: users
# ssh_pwauth: True
# ssh-authorized-keys:
# - ssh-rsa XXXXXX
chpasswd:
list: |
root:linux
expire: False
EOF
cat <<EOF > meta-data
instance-id: id-12345
local-hostname: cloudy
EOF
popd
# generate the seed images
genisoimage -output seed.img -volid cidata -joliet -rock $tmpdir/
# for vfat
truncate --size 2M seed-vfat.img
mkfs.vfat -n cidata seed-vfat.img
mcopy -oi seed-vfat.img $tmpdir/user-data $tmpdir/meta-data ::
rm -rf $tmpdir
# then try:
# qemu-system-x86_64 -m 512 -net nic -net user,hostfwd=tcp::2222-:22 -drive file=SLE12-Base.qcow2,if=virtio -drive file=seed.img,if=virtio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment