# BEGIN essential example code ipaddress = "192.168.0.166" # a possible modification pointed out # makes sense e.g. if used together with whateverVm.vmxFile.setEthernetAdapter(adapter, "hostonly") #ipaddress = IPAddress.numberWithinSubnet(VMwareHypervisor.localHostOnlyIPAddress, 166) rootpw = "redwood" # Ubuntu kickstart supports only one regular user regularUser = ("jack","rainbow") # one possible way of making new VM names and directories name = IPAddress.nameWithNumber("example", ipaddress, separator=None) exampleVm = VMwareMachine(ScriptUser.loggedIn.userHomeRelative("vmware/examples/%s/%s.vmx" % (name, name))) # make the virtual machine exists = exampleVm.vmxFile.exists() if exists == False: exampleVm.mkdir() downloadedDistroIsoImage = UbIsoImage(Download.fromUrl ("http://releases.ubuntu.com/precise/ubuntu-12.04.3-alternate-i386.iso")) # some possible choices pointed out # server w command line only kickstartFileContent = UbKickstartFileContent(UbKickstartTemplates.usableUbKickstartTemplate001) kickstartFileContent.replaceRootpw(rootpw) kickstartFileContent.ubReplaceHostname(exampleVm.basenameStem) kickstartFileContent.ubCreateNetworkConfigurationSection() kickstartFileContent.ubAddNetworkConfigurationStatic(device="eth0", ipaddress=ipaddress, nameservers=Nameserver.list) # put in DHCP at eth0, to be used with NAT, works well if before hostonly #kickstartFileContent.ubAddNetworkConfigurationDhcp("eth0") #kickstartFileContent.ubAddNetworkConfigurationStatic(device="eth1", ipaddress=ipaddress, nameservers=Nameserver.list) # some possible modifications pointed out #kickstartFileContent.ubSetUpgradeNone() #kickstartFileContent.ubSetUpgradeSafe() #kickstartFileContent.ubSetUpgradeFull() kickstartFileContent.ubSetUpdatePolicyNone()
(name, name))) # make the virtual machine exists = exampleVm.vmxFile.exists() if exists == False: exampleVm.mkdir() # # comment solely regarding .iso files larger than 4GB, e.g. x86_64 Install-DVD, # there had been issues that almost have gone away with a fixed newer version iso-read, # there is a fix in libcdio (which provides iso-read) 0.92, # the remaining issue is you need to make sure you have libcdio 0.92 installed # #downloadedDistroIsoImage = ElIsoImage(ScriptUser.loggedIn.userHomeRelative \ # ("Downloads/SL-64-i386-2013-03-18-Install-DVD.iso")) downloadedDistroIsoImage = ElIsoImage( Download.fromUrl( "http://ftp.scientificlinux.org/linux/scientific/6.4/i386/iso/SL-64-i386-2013-03-18-Install-DVD.iso" )) # some possible choices pointed out # server w command line only kickstartFileContent = ElKickstartFileContent( ElKickstartTemplates.usableElKickstartTemplate001) kickstartFileContent.replaceRootpw(rootpw) kickstartFileContent.elReplaceHostname(exampleVm.basenameStem) kickstartFileContent.elReplaceStaticIP(ipaddress, nameservers=Nameserver.list) # put in DHCP at eth0, to be used with NAT, works well if before hostonly #kickstartFileContent.elReplaceStaticIP(ipaddress, nameservers=[]) #kickstartFileContent.elAddNetworkConfigurationWithDhcp("eth0") # some possible modifications pointed out #kickstartFileContent.replaceAllPackages(ElKickstartTemplates.packagesOfSL64Minimal) #kickstartFileContent.removePackage("@office-suite")
# one possible way of making new VM names and directories name = IPAddress.nameWithNumber("example", ipaddress, separator=None) exampleVm = VMwareMachine(ScriptUser.loggedIn.userHomeRelative("vmware/examples/%s/%s.vmx" % (name, name))) # make the virtual machine exists = exampleVm.vmxFile.exists() if exists == False: exampleVm.mkdir() # # comment solely regarding .iso files larger than 4GB, e.g. x86_64 Install-DVD, # there had been issues that almost have gone away with a fixed newer version iso-read, # there is a fix in libcdio (which provides iso-read) 0.92, # the remaining issue is you need to make sure you have libcdio 0.92 installed # #downloadedDistroIsoImage = ElIsoImage(ScriptUser.loggedIn.userHomeRelative \ # ("Downloads/SL-64-i386-2013-03-18-Install-DVD.iso")) downloadedDistroIsoImage = ElIsoImage(Download.fromUrl ("http://ftp.scientificlinux.org/linux/scientific/6.4/i386/iso/SL-64-i386-2013-03-18-Install-DVD.iso")) # some possible choices pointed out # server w command line only kickstartFileContent = ElKickstartFileContent(ElKickstartTemplates.usableElKickstartTemplate001) kickstartFileContent.replaceRootpw(rootpw) kickstartFileContent.elReplaceHostname(exampleVm.basenameStem) kickstartFileContent.elReplaceStaticIP(ipaddress, nameservers=Nameserver.list) # put in DHCP at eth0, to be used with NAT, works well if before hostonly #kickstartFileContent.elReplaceStaticIP(ipaddress, nameservers=[]) #kickstartFileContent.elAddNetworkConfigurationWithDhcp("eth0") # some possible modifications pointed out #kickstartFileContent.replaceAllPackages(ElKickstartTemplates.packagesOfSL64Minimal) #kickstartFileContent.removePackage("@office-suite") #kickstartFileContent.addPackage("httpd") # some other possible modifications pointed out #kickstartFileContent.replaceAllPackages(ElKickstartTemplates.packagesOfSL64MinimalDesktop)
# one possible way of making new VM names and directories name = IPAddress.nameWithNumber("example", ipaddress, separator=None) exampleVm = VMwareMachine(ScriptUser.loggedIn.userHomeRelative("vmware/examples/%s/%s.vmx" % (name, name))) # make the virtual machine exists = exampleVm.vmxFile.exists() if exists == False: exampleVm.mkdir() # # comment solely regarding .iso files larger than 4GB, e.g. x86_64 Install-DVD, # there had been issues that almost have gone away with a fixed newer version iso-read, # there is a fix in libcdio (which provides iso-read) 0.92, # the remaining issue is you need to make sure you have libcdio 0.92 installed # #downloadedDistroIsoImage = ElIsoImage(ScriptUser.loggedIn.userHomeRelative \ # ("Downloads/CentOS-6.6-i386-bin-DVD1.iso")) downloadedDistroIsoImage = ElIsoImage(Download.fromUrl ("http://mirrors.usc.edu/pub/linux/distributions/centos/6.6/isos/i386/CentOS-6.6-i386-bin-DVD1.iso")) # some possible choices pointed out # server w command line only kickstartFileContent = ElKickstartFileContent(ElKickstartTemplates.usableElKickstartTemplate001) kickstartFileContent.replaceRootpw(rootpw) kickstartFileContent.elReplaceHostname(exampleVm.basenameStem) kickstartFileContent.elReplaceStaticIP(ipaddress, nameservers=Nameserver.list) # put in DHCP at eth0, to be used with NAT, works well if before hostonly #kickstartFileContent.elReplaceStaticIP(ipaddress, nameservers=[]) #kickstartFileContent.elAddNetworkConfigurationWithDhcp("eth0") # some possible modifications pointed out #kickstartFileContent.replaceAllPackages(ElKickstartTemplates.packagesOfSL64Minimal) #kickstartFileContent.removePackage("@office-suite") #kickstartFileContent.addPackage("httpd") # some other possible modifications pointed out #kickstartFileContent.replaceAllPackages(ElKickstartTemplates.packagesOfSL64MinimalDesktop)
ipaddress = "192.168.0.166" # a possible modification pointed out # makes sense e.g. if used together with whateverVm.vmxFile.setEthernetAdapter(adapter, "hostonly") #ipaddress = IPAddress.numberWithinSubnet(VMwareHypervisor.localHostOnlyIPAddress, 166) rootpw = "redwood" # Ubuntu kickstart supports only one regular user regularUser = ("jack","rainbow") # one possible way of making new VM names and directories name = IPAddress.nameWithNumber("example", ipaddress, separator=None) exampleVm = VMwareMachine(ScriptUser.loggedIn.userHomeRelative("vmware/examples/%s/%s.vmx" % (name, name))) # make the virtual machine exists = exampleVm.vmxFile.exists() if exists == False: exampleVm.mkdir() # several packages installed OK until Ubuntu 12.04.4, but apparently not in Ubuntu 12.04.5 downloadedDistroIsoImage = Ub1204IsoImage(Download.fromUrl ("http://releases.ubuntu.com/12.04.4/ubuntu-12.04.4-alternate-i386.iso")) # some possible choices pointed out # server w command line only kickstartFileContent = UbKickstartFileContent(UbKickstartTemplates.usableUbKickstartTemplate001) kickstartFileContent.replaceRootpw(rootpw) kickstartFileContent.ubReplaceHostname(exampleVm.basenameStem) kickstartFileContent.ubCreateNetworkConfigurationSection() kickstartFileContent.ubAddNetworkConfigurationStatic(device="eth0", ipaddress=ipaddress, nameservers=Nameserver.list) # put in DHCP at eth0, to be used with NAT, works well if before hostonly #kickstartFileContent.ubAddNetworkConfigurationDhcp("eth0") #kickstartFileContent.ubAddNetworkConfigurationStatic(device="eth1", ipaddress=ipaddress, nameservers=Nameserver.list) # some possible modifications pointed out #kickstartFileContent.ubSetUpgradeNone() #kickstartFileContent.ubSetUpgradeSafe() #kickstartFileContent.ubSetUpgradeFull() kickstartFileContent.ubSetUpdatePolicyNone()