VMware Cloud Community
WillianCardoso
Contributor
Contributor

CentOS 7 - Customization doesn't Work

Hellow Guys,

I have a perfect customization spec. Working very good with rhel6 and centos6.

My problem started when I need to test the spec with the rhel7 or centos7.

Below, a litter bit the my code:

var myCustomizationFixedName = new VcCustomizationFixedName();

  myCustomizationFixedName.name = HOSTNAME;

//------------------------------------------------------------------------------------------

// Fixa o hostname e domain

//------------------------------------------------------------------------------------------

var myCustomizationLinuxPrep = new VcCustomizationLinuxPrep();

  myCustomizationLinuxPrep.domain = dnsDomain;

  myCustomizationLinuxPrep.hostName = myCustomizationFixedName;

//------------------------------------------------------------------------------------------

// Cria um Custom Spec e attach os objetos de rede, DNS e adapter

//------------------------------------------------------------------------------------------

var myCustomizationSpec = new VcCustomizationSpec();

  myCustomizationSpec.identity = myCustomizationLinuxPrep;

  myCustomizationSpec.globalIPSettings = attGlobalIPSettings;

  myCustomizationSpec.nicSettingMap = attNicSettingMap;

cloneSpec.config = configSpec;

cloneSpec.customization = myCustomizationSpec;

When I use this spec, the VMware Orchestrator create the Virtual Machine, configure IP but doesn't configure the HOSTNAME. The problem it's!!!! Doesn't configure HOSTNAME.


Somebody already had this problem?
Thank very much!!!!

0 Kudos
1 Reply
vMarkusK1985
Expert
Expert

Is customisation of CentOS 7 supportet?

I use a in guest script for network settings:

#!/bin/bash

HOSTNAME=$1

IP=$2

SUBNET=$3

GATEWAY=$4

DOMAIN=$5

SEARCH=$6

DNS1=$7

DNS2=$8

echo "$HOSTNAME" > /etc/hostname

echo "# This file is created by vCO" > /etc/sysconfig/network-scripts/ifcfg-eth0

echo "BOOTPROTO=static" >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo "NAME=eth0" >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo "DEVICE=eth0" >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo "IPADDR=$IP" >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo "NETMASK=$SUBNET" >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo "GATEWAY=$GATEWAY" >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo "# This file is created by vCO" > /etc/sysconfig/network

echo "HOSTNAME=$HOSTNAME" >> /etc/sysconfig/network

echo "DNS1=$DNS1" >> /etc/sysconfig/network

echo "DNS2=$DNS2" >> /etc/sysconfig/network

echo "DOMAIN=$DOMAIN" >> /etc/sysconfig/network

echo "SEARCH=$SEARCH" >> /etc/sysconfig/network

touch /root/customization-complete

I know, its not the best way but It works fine.

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK
0 Kudos