Question

I am using chef's knife-vcloud plugin. https://github.com/astratto/knife-vcloud I am able to create a new vm, using an existing catalog with the given documentation by, knife vc vapp create MyorgVDC-Tier1 chefnode2 "Just Created node2" WhAtEvEr-Id-tO-bE-SeEn

When I start the vm it by default takes the hostname that is given to the catalog. I tried modifying it by knife vc vm set info --name ChefNewNode WhAtEvEr-Id-tO-bE-SeEn --vapp MyvApp_Chef centos I want to change the hostname as per the role of the machine. At present I see this output. How do I change the hostname of the machine?

[root@chefworkstation ~]# knife vc vm show WhAtEvEr-Id-tO-bE-SeEn Note: --vapp and --vdc not specified, assuming VM is an ID VM Name: ChefNewNode OS Name: CentOS 4/5/6 (64-bit) Status: running

Cpu
Number of Virtual CPUs 1 virtual CPU(s)

Memory
Memory Size 512 MB of memory

Disks
Hard disk 1 16384 MB
Hard disk 2 16384 MB

Networks
MyorgNet-Router

Index 0
Ip 192.168.0.117
External ip
Is connected true
Mac address 10:20:30:40:50:0f
Ip allocation mode MANUAL

Guest Customizations
Enabled true
Admin passwd enabled true
Admin passwd auto false
Admin passwd
Reset passwd required false

Computer name centos

Was it helpful?

Solution

We can achieve this by changing the guest computer name. Note that the VM must be turned off to change any guest customization.

Command to change guest computer name:

knife vc vm config guest <vm name> --vapp <vapp name> --vdc <vdc name> --guest-computer-name <guest computer name> --admin-passwd <root password>

OTHER TIPS

The --name you are passing is the Chef node name, not the hostname. If you want to change the hostname, you'll need to write/use a recipe that modifies /etc/hostname and runs some commands to persist. For example: https://github.com/3ofcoins/chef-cookbook-hostname

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top