Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philroche/be0fb701b6b59d5d5f62f685a6ee3838 to your computer and use it in GitHub Desktop.
Save philroche/be0fb701b6b59d5d5f62f685a6ee3838 to your computer and use it in GitHub Desktop.
An exmple of changing the datasource in cloud-init
# Get the Ubuntu cloud image of your choosing (this example uses the latest Xenial daily)
wget http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
# Set the cloud-init datasource to use explicitly (this example uses the EC2 datasource)
sudo mount-image-callback xenial-server-cloudimg-amd64-disk1.img -- \
sh -c 'echo "datasource: Ec2" > $MOUNTPOINT/etc/cloud/ds-identify.cfg'
# Confirm the current datasource configuration
sudo mount-image-callback xenial-server-cloudimg-amd64-disk1.img -- \
chroot _MOUNTPOINT_ cat /etc/cloud/ds-identify.cfg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment