Setting hostnames while cloning template. | Nutanix Community
Skip to main content
Question

Setting hostnames while cloning template.

  • December 4, 2020
  • 2 replies
  • 508 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

Neel Kotak
Nutanix Employee
Forum|alt.badge.img+4
  • Nutanix Employee
  • 96 replies
  • December 4, 2020

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?


  • Author
  • Voyager
  • 1 reply
  • December 4, 2020

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