I've used cloud-init and would vote for that.
What I've done is create bare minimum templates with ssh, redhat-lsb as
appropriate, and a known password.
I refer to these as stepping stone templates that only exist for admins to
create templates from absolutely bare minimal installs.
I have created them for several different distros, and versions of those
distros.
I will launch a instance from the distro specific stepping stone template.
Then run an ansible play against that new instance.
The ansible does some basic configuration.
updates to latest packages.
installs cloud-init and adds configuration for a default user that is the
same across all our templates.
makes sure required packages for growing root partition are installed
(cloud-utils-growpart is missing on RedHat based distros).
cleans package caches.
copies over a final prep script to run.
that final scripts nukes users, resets cloud-init, nukes ssh server keys,
etc., finally nukes itself and shuts the instance down.
Once that instance shuts down I manually make a template from the root drive.
Eventually that manual step should be automated with cloudmonkey.
Default configuration of cloud-init on all distros I have tried takes care of
pretty much everything, and only needed a small configuration to make the
default user consistent across templates.
If I need more specific templates I'll have a play that applies those ansible
roles first, then applies the template_prep role.
This works for our relatively simple needs right now, but is structured so that
it should scale to whatever our needs morph into.
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: "Vivek Kumar"
To: "users"
Cc: "dev"
Sent: Sunday, September 19, 2021 12:54:53 PM
Subject: Re: How to create Templates in CloudStack
Hello Saurabh,
So there are two ways to achieve your requirement -
1- You Deploy a VM from ISO and install whatever you need and then create a
template out of it..! It means whenever you will deploy VM using this template
you will have pre-installed your package and base config. Post deployment you
will only need to change as per your requirement. So the idea is to create a
base template which should be at least, Wordpress installed, cpannel and other
tools without config. You deploy VM and do the config as per your requirement.
2- Second option is - You just create a very basic OS template i.e Centos and
ubuntu, and install your requirements using user-data while deploying the
instances. You will have to be ready with ready made scripts which you will
pass while launching the instances in base64.
You may also want to explore cloud-init which is very useful in such tasks.
Vivek Kumar
Sr. Manager - Cloud & DevOps
IndiQus Technologies
M +91 7503460090
www.indiqus.com
> On 19-Sep-2021, at 8:12 PM, Saurabh Rapatwar
> wrote:
>
> Hello
>
> We are using CloudStack to sell Public Cloud. For this purpose we want to
> customise the templates like below:
>
> 1. Ubuntu with Wordpress
> 2. CentOS with Cpanel
> 3. Windows Server with Plesk Panel
> 4. All the the popular versions of respective popular OS
>
> What is the procedure to do this like we do in AWS, GCP, Vultr etc.
>
> This is something we have been trying to figure out for a long time but
> haven't found any concrete solution yet.
>
> Guidance would be appreciated.
>
> Thank You
> Saurabh