Hi Krzys,

Krzys wrote On 02/05/07 12:39,:
hello, I just got into zones and I have few questions:

is there any way to create zone with some additional customizations?

here is what I did:
# zonecfg -z titan1
titan1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:titan1> create
zonecfg:titan1> set zonepath=/zones/titan1
zonecfg:titan1> set autoboot=true
zonecfg:titan1> add net
zonecfg:titan1:net> set address=192.168.1.82
zonecfg:titan1:net> set physical=bge0
zonecfg:titan1:net> end
zonecfg:titan1> info
zonecfg:titan1> verify
zonecfg:titan1> commit
zonecfg:titan1> exit


Ok, so that created my zone. Now I have to login and changethe following:
passwd file to point to new root home directory: /root/
add users.
change syslog.conf settings
make appriopriate changes in /etc/hosts file.
make changes to /etc/mail/sendmail.cf

is there any way to automate it? I did create only 10 zones and its not to crazy to login to each of them and do all those different config changes etc, but I was wondering if there was any easier way of doing all of them at the creation time by scripts. I did setup scripts to do most of the stuff with zone creation, to allocate resources per zones, and to zreate zfs for each zone with all the settings that I needed but I was wondering if I can automate it even more.

Cloning in 11/06 and NV copies over a lot of things, including SMF repository, from what I experienced. Your /etc/inet/hosts file will probably still be unique and need to be customized after install/clone, and possibly before first boot. I have a script that does a lot of the sysidcfg stuff, in addition to the sysidcfg file.

# cat zoneXcreate.sh
#!/bin/sh

. ./zoneXlocal.include

while [ $I -le $M ]
do
   echo "$I \c"

   HOST=`expr ${HOSTBASE} + ${I}`

   # Configure the zone
   sed -e "s%X%${HOST}%g" zoneX${ZONETYPE}.cfg | \
      sed -e "s%ZONEPATH%${ZONEROOT}%g" > /tmp/zone${HOST}
   zonecfg -z zone${HOST} -f /tmp/zone${HOST}
   rm /tmp/zone${HOST}

   # Install the zone from a master, if it exists
   S=`zoneadm -z ${ZONEMASTER} list > /dev/null 2>&1`
   if [ $? -eq 0 ]
   then
      zoneadm -z zone${HOST} clone ${ZONEMASTER}
   else
      zoneadm -z zone${HOST} install
   fi

   # Set configuration information prior to initial boot
   sed -e "s/X/${HOST}/g" zoneX.sysidcfg > 
$ZONEROOT/zone${HOST}/root/etc/sysidcfg
   echo "${NETBASE}.${HOST}/${NETMASKSIZE}" > \
      ${ZONEROOT}/zone${HOST}/root/etc/hostname.vnic${HOST}
   echo "\n${NETBASE}.${HOST}   zone${HOST}" >> 
${ZONEROOT}/zone${HOST}/root/etc/hosts
   echo "\n${NETBASE}.0 ${NETMASK}" >> ${ZONEROOT}/zone${HOST}/root/etc/netmasks
   echo "$DEFROUTER" >> ${ZONEROOT}/zone${HOST}/root/etc/defaultrouter
   echo "zone${HOST}" >> ${ZONEROOT}/zone${HOST}/root/etc/nodename

   zoneadm -z zone${HOST} boot

   I=`expr $I + 1`

done
echo

# cat zoneXlocal.include
### To be customized per host

M=4 ; I=1

NETBASE="10.1.14"
NETMASK="255.255.255.192"
NETMASKSIZE=26
HOSTBASE=150
INTERFACE=e1000g2
MAC="0:3:ba:d8:50"
DEFROUTER="10.1.14.129"

ZONEROOT=/export/zones
ZONEMASTER=zoneX
ZONETYPE=exclusive
#ZONETYPE=shared


Steffen

reply-to set to: zones-discuss@opensolaris.org


Thanks for any help or pointers that you could give to me...

Chris

_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org
_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to