If you prefer cloud-init you can use this guide -> 
http://qa.cloudstack.cloud/docs/WIP-PROOFING/pr/215/adminguide/templates/_cloud_init.html

Best regards,
Jordan 

-----Original Message-----
From: Darren Cole <dc...@aseg.com.INVALID> 
Sent: Wednesday, November 3, 2021 8:29 PM
To: users <users@cloudstack.apache.org>
Subject: Re: ssh key pairs not working for ubuntu VM


[X] This message came from outside your organization


I've gotten templates Ubuntu 20.04 (and 18.04) built for my Cloudstack clusters.
The iso out of the box didn't work, or at least required me to access the 
console to get the initial install done.

I have a two step process I've described before, and am still waiting on 
approval for some ansible I wrote to push it to a public repo.
Create a very basic template with ssh and a known password.
I call this a stepping stone template and is only used by admins to create the 
templates users actually use.
Then I spin up an instance from that template and run my ansible against it.
Once the instance shuts down I manually create a template from it.

That ansible has a few steps:
  Get su or sudo configured enough for the rest of the play to run
  install a minimal set of required/desired packages (rsyslog on Centos, tar, 
zip, etc).
  install and configure required cloud-init packages, make sure 
cloud-utils-growpart is install on RedHat systems
  cleanup package caches
  template over the final script that does the final cleanup.
  run the final scripts async from the ansible and disconnect.
The script does a few things
  sleep for a bit to make sure the ansible disconnects
  delete and remove sudoers files for users
  lock the root password
  remove cloud-init logs
  reset cloud-init (cloud-init clean)
  remove ssh host keys
  remove the script itself
  shutdown -P now

I found -P more reliably powers off the instance than -H.
Eventually I intend to automate making the template instead of manual steps in 
the webconsole.

Darren
--
This e-mail is confidential. Any distribution, use or copying of this e-mail or 
the information it contains other than by the intended recipient is forbidden. 
If you are not the intended recipient, please advise the sender (by return 
e-mail or otherwise) immediately and delete this e-mail.

----- Original Message -----
From: "Peter Stine" <peter.st...@granddial.com.INVALID>
To: "users" <users@cloudstack.apache.org>
Sent: Tuesday, November 2, 2021 12:50:21 PM
Subject: ssh key pairs not working for ubuntu VM

Hello all,

I have been attempting to get a SSH key pair to be set on a VM template using 
Ubuntu server 20.04 (I downloaded the iso from the Ubuntu website, then created 
a VM from it.), but I do not seem to be able to get it work. My VMs are running 
with kvm as the hypervisor.

I have been following this guide: 
https://urldefense.com/v3/__http://docs.cloudstack.apache.org/en/latest/adminguide/templates.html*uploading-templates-from-a-remote-http-server__;Iw!!A6UyJA!xw2NyLYQBA44F2FBRGsd45yq24Gk2nc6nWulaz8TXyFlF8GS4zM-7YNwIO70yOpo30VSh3JGkswu$
  but when I follow all the steps, I cannot login to the machine anymore.

Are there any official ubuntu templates that have this ssh and password change 
ability baked in? Or is there something else that I should try?

Thanks!
Peter

Reply via email to