CenturyLinkCloud / chef-provisioning-vsphere

A chef-provisioning provisioner for VMware vSphere
MIT License
66 stars 57 forks source link

How to create multiple Windows servers using chef-provisioning-vsphere #93

Open bhaliti opened 7 years ago

bhaliti commented 7 years ago

Hi,

Seems like my other issue has been closed without my questions being answered.

All I want to know IS IT POSSIBLE TO BUILD MULTIPLE WINDOWS SERVERS USING CHEF-PROVISIONING-VSPHERE???

how do I modify this example you've provided to customize IPs on all the servers and join them to the domain. I want to be able to build let's say 10 servers with custom IP, name, and domain etc

with_machine_options :bootstrap_options => { use_linked_clone: true, num_cpus: 2, memory_mb: 4096, network_name: ['vlan_20_172.21.20'], datacenter: 'datacenter_name', resource_pool: 'cluster', template_name: 'path to template', customization_spec: { ipsettings: { dnsServerList: ['1.2.3.31','1.2.3.41'] }, domain: 'blah.com', domainAdmin: 'administrator@blah.com', domainAdminPassword: 'Passwordyoyoyo', org_name: 'acme', product_id: 'CDAA-87DC-3455-FF77-2AAC', win_time_zone: 4 } ssh: { user: 'administrator', password: 'password', paranoid: false, } }, :convergence_options => { :ssl_verify_mode => :verify_none }

How do I modify above recipe to accomplish that???? is it even possible???

thanks

bhaliti commented 7 years ago

anything?

bradwilliamson commented 7 years ago

You need to use machine_batch when creating more than one machine. There are a lot of gotchas if you have machines that need to have different IP addresses, different port groups. Here is a generic example of something you might work off of. I might have a couple errors in here and don't currently have access to vCenter to test this. Hope it helps.

chef_gem 'chef-provisioning-vsphere' do action :install compile_time true end

require 'chef/provisioning/vsphere_driver'

with_vsphere_driver host: '127.0.0.1', insecure: true, user: 'boomer', password: 'sooner'

Williamson 12-15-15 Big Hash value shared between machines

shared_options = { :bootstrap_options => { use_linked_clone: false, network_name: ['vlan_20_172.21.20'], datacenter: 'devops', datastore: 'superfast', resource_pool: 'devops_Production_Cluster_01', vm_folder: 'Organizational Units/DEVOPS', template_name: 'flark', customization_spec: { ipsettings: { gateway: ["10.100.1.1"], subnetMask: '255.255.255.0', dnsServerList: ['10.100.1.20'],

}, domain: 'blah.com', domainAdmin: 'administrator@blah.com', domainAdminPassword: 'Passwordyoyoyo', org_name: 'acme', product_id: 'CDAA-87DC-3455-FF77-2AAC', win_time_zone: 4 }, :ssh => { :user => 'administrator', :password => 'password', :paranoid => false, },

:convergence_options => { :ssl_verify_mode => :verify_none } } }

machine_batch do custom_options = shared_options.dup 1.upto(10) do |i|

Count from 10.100.90.21 to 30

custom_options[:customization_spec][:ipsettings][:ip]="10.100.90.2#{i}" machines %w(Web1 DC1 SQL1 DC2 Web50 ChefWS1 ChefWS05 Gold Silver L1E5DVOP) do machine_options custom_options run_list ["recipe[chefrules::sqlmp4]"] end end

bradwilliamson commented 7 years ago

Did this work for you @bhaliti Thanks,

bhaliti commented 7 years ago

I have not had the time to test this yet. I really appreciate it though. Thank you! Will let you know