Giter Site home page Giter Site logo

vm clone windows template? about knife-vsphere HOT 5 CLOSED

chef avatar chef commented on August 24, 2024
vm clone windows template?

from knife-vsphere.

Comments (5)

WilcoE avatar WilcoE commented on August 24, 2024

same issue here ..

from knife-vsphere.

WilcoE avatar WilcoE commented on August 24, 2024

any process on this, this is the only issue/reason why knife is not usable for me

from knife-vsphere.

lamont avatar lamont commented on August 24, 2024

I was able to accomplish the same task using rbvmomi and swapping out the CustomizationLinuxPrep for CustomizationSysprep. Presumably anybody could leverage the spec plugin feature of knife-vsphere to do the same work. The example below is from a script I wrote for this purpose, and not a direct plugin for knife-vsphere, but hopefully this gives you an example to work from

custom_spec = VIM.CustomizationSpec(
    # linux uses globalIPSettings, but they might choke windows
    :globalIPSettings => VIM.CustomizationGlobalIPSettings(
        :dnsServerList => ["1.2.3.4", "5.6.7.8"],
        :dnsSuffixList => ["blah.blahtest.com"] ),
    :identity => VIM.CustomizationSysprep(
        :guiRunOnce => VIM.CustomizationGuiRunOnce(
            # you know what matters here? escaping backslashes. Learn from my failures.
            :commandList => ["c:\\opscode\\chef\\bin\\chef-client.bat","shutdown /l"]
        ),
        :guiUnattended => VIM.CustomizationGuiUnattended(
            :autoLogon => true,
            :autoLogonCount => 1,
            :password => VIM.CustomizationPassword(
                :value => "heyboo",
                :plainText => true
            ),
            # this should be the Arizona TZ
            :timeZone => 015
        ),
        :identification => VIM.CustomizationIdentification(
            :domainAdmin => "domainadmin",
            :domainAdminPassword => VIM.CustomizationPassword(
                :value => "domainpass",
                :plainText => true
            ),
            :joinDomain => "blah.blahtest.com"
        ),
        :userData => VIM.CustomizationUserData(
            :computerName => VIM.CustomizationFixedName( :name => opts[:name].split('.').first ),
            :fullName => "BigCorp Inc",
            :orgName => "BigCorp Inc",
            :productId => "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
        ),
    ),
    :nicSettingMap =>  [ VIM.CustomizationAdapterMapping(
        :adapter => VIM.CustomizationIPSettings(
          :dnsDomain => "blah.blahtest.com",
          :dnsServerList => [ "1.2.3.4", "5.6.7.8" ],
          :gateway => [ opts[:ip].gsub(%r(\.\d+$), ".1") ],
          :ip => VIM.CustomizationFixedIp( :ipAddress => opts[:ip] ),
          :subnetMask => "255.255.255.0"
        )
      ) ],
    :options => VIM.CustomizationWinOptions(
        :changeSID => true,
        :deleteAccounts => false
    )
)

Then that was pulled into the clone task via:

# combine all the above into one spec object for the cloning task
spec = VIM.VirtualMachineCloneSpec(:config => clone_spec, :location => relocateSpec, :customization => custom_spec, :powerOn => true, :template => false)

from knife-vsphere.

lamont avatar lamont commented on August 24, 2024

I put the short computer name in identity.userData.computerName.

To find the full list of options, refer to the vsphere VIM api:

http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.customization.UserData.html

But I also pass the FQDN as an option directly during the clone operation:

task = src_vm.CloneVM_Task(:folder => src_vm.parent.parent, :name =>
opts[:name], :spec => spec)

from knife-vsphere.

swalberg avatar swalberg commented on August 24, 2024

Closing as this seems to be solved. If not, please re-open or create a new issue.

from knife-vsphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.