Create a Ubuntu 18.04 cloud init template
-
This post is deleted! -
@bcatubig I've done all the magic but still my cloud init is not taken into account completely.
I can see the VM is created with 10 MB additional disk.
I can mount this device and see that it does contain my cloud-init script.
but the script is not executed and cloud-config logs don't contain any useful information.
Please advise what would be the right way to track this issue?? -
@moisei Can you list steps taken?
Can you verify that
ConfigDriveis enabled in thedpkg-reconfigureofcloud-init?I haven't experimented with a full cloud-config. Only injecting an SSH key via XOA. I'll run through the steps again tonight to see if I run into any issues.
-
@bcatubig yes
ConfigDriveand onlyConfigDriveis enabled. My script does 3 things: SSH, set hostname, and touch some file. None of them is executed and the cloud-init logs doesn't show any trace of the execution.#cloud-init hostname: {name}% ssh_authorized_keys: - ssh-rsa AAAA...kd mykey@myhost runcmd: - [ touch, "/tmp/CLOUD_INIT_WAS_HERE", / ] - touch /tmp/CLOUD_INIT_WAS_HERE_1 - touch "/tmp/CLOUD_INIT_WAS_HERE_2" -
@moisei Before rebooting the Ubuntu 18.04 vm to convert it to an image, did you enable
cloud-initservice by runningsudo systemctl enable cloud-initbefore powering off the vm?
-
@bcatubig yes I did. I've just followed your instructions above. Also the fact the cloud-init logs are present indicates that it is running, isn't it?
-
@moisei Sure
Can you try running
dpkg-reconfigure cloud-initand select bothConfigDriveand theOpenstackoption.From there, I would try the vm template process again.
If that still fails, I would try manually invoking cloud-config from the new vm with the attached cloud-config drive to see if there is an issue with cloud-config or your config.
It should provision itself automatically if everything is correct.
If that fails, you may need to attempt the entire process again and do some more trial/error.
-
@bcatubig it didn't help. would you mind to share the config that is working for you?
-
@moisei I didn't use a custom cloud config. I've only tried adding the ssh-key via XOA
-
I see this message on the console right after the VM is created. Could it be somehow helpful?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login