Question

Setting hostnames while cloning template.

  • 4 December 2020
  • 2 replies
  • 146 views

Hello,

 

Is there any way to use variables for hostnames while cloning VMs from template with Prism (Custom script/cloud init)?

For instance can I set hostname equal to VM name (prefix name + index)?

 

brg,

Serhiy.

 


2 replies

Userlevel 3
Badge +4

Hi @Serhiy  Are you talking about renaming the Hypervisor name? 

Is it possible for you to elaborate on your requirement in detail with an examples and reason to do so?

Hi @Neel Kotak ,

Let's say I have an prepared template (some Linux with a bundle of software) and want to create ‘n’ virtual machines.
So I go to the Prism -> VM, right-click on the template and choose 'Clone', in the wizard window I can set 'Number of Clones', 'Prefix Name' and in the Custom Script put something like:

#cloud-config
repo_update: true
repo_upgrade: all
hostname: cos8-test
fqdn: cos8-test.local
password: centos
chpasswd: { expire: False }
ssh_pwauth: True

In that case I will have 'n' VMS with hostname 'cos8-test' but I want to have 'n' VMs with names cos8-test-01,.., cos8-test-'n'.

Reply