Merge branch 'cliffe:master' into fix-gemfile

This commit is contained in:
Tom Harrison
2023-01-09 18:28:06 +00:00
committed by GitHub
3 changed files with 64 additions and 23 deletions

View File

@@ -147,10 +147,17 @@ SecGen accepts arguments to change the way that it behaves, the currently implem
ESXI OPTIONS:
--esxiuser [esxi_username]
--esxipass [esxi_password]
--esxi-url [esxi_api_url]
--esxi-hostname [esxi_api_url]
(ESXi hostname/IP)
--esxi-datastore [esxi_datastore]
--esxi-disktype [esxi_disktype]
--esxi-disktype [esxi_disktype]: 'thin', 'thick', or 'eagerzeroedthick'
(If unspecified, it will be set to 'thin')
--esxi-network [esxi_network_name]
(If its not specified, the default is to use the first found)
--esxi-guest-nictype [esxi_nictype]: 'e1000', 'e1000e', 'vmxnet', 'vmxnet2', 'vmxnet3', 'Vlance', or 'Flexible'
(RISKY - Can cause VM to not respond)
--esxi-no-hostname
(Setting the hostname on some boxes can cause vagrant up to fail if the network configuration was not previously cleaned up.)
COMMANDS:
run, r: Builds project and then builds the VMs

View File

@@ -63,28 +63,31 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
# oVirt provider end
<% elsif (@options.has_key? :esxiuser) && (@options.has_key? :esxipass) %>
<% elsif (@options.has_key? :esxiuser) %>
# vmware_esxi provider begin
<%= system.name %>.vm.provider :vmware_esxi do |esxi|
<%=
" esxi.esxi_hostname = '#{@options[:esxi_url]}'
" esxi.esxi_hostname = '#{@options[:esxi_host]}'
esxi.esxi_username = '#{@options[:esxiuser]}'
esxi.esxi_password = '#{@options[:esxipass]}' "
esxi.esxi_password = '#{@options[:esxipass]}'"
%>
<%= if @options.has_key? :esxidatastore
" esxi.esxi_disk_store = '#{@options[:esxidatastore]}'"
" esxi.esxi_disk_store = '#{@options[:esxidatastore]}'\n"
end -%>
<%= if @options.has_key? :esxi_disktype
" esxi.guest_disk_type = '#{@options[:esxi_disktype]}'"
<%= if @options.has_key? :esxidisktype
" esxi.guest_disk_type = '#{@options[:esxidisktype]}'\n"
end -%>
<%= " esxi.guest_memsize = '#{system.memory} MB'\n"
<%= " esxi.guest_memsize = '#{system.memory} MB'\n"
-%>
<%= if @options.has_key? :cpu_cores
" esxi.guest_numvcpus = #{@options[:cpu_cores]}\n"
<%= if @options.has_key? :cpu_cores
" esxi.guest_numvcpus = #{@options[:cpu_cores]}\n"
end -%>
end
# End ESXi provider
<%= if @options.has_key? :esxinetwork
" esxi.esxi_virtual_network = ['#{@options[:esxinetwork]}']\n"
end -%>
<%= " esxi.guest_name = '#{system.get_hostname}'\n" -%>
end
# End ESXi provider
<%
else %>
<%= system.name %>.vm.provider :virtualbox do |vb|
@@ -148,7 +151,9 @@ end
<%= system.name %>.vm.box = 'ovirt4'
<%= system.name %>.vm.box_url = 'https://github.com/myoung34/vagrant-ovirt4/blob/master/example_box/dummy.box?raw=true'
<% elsif (@options.has_key? :esxiuser) && (@options.has_key? :esxipass) %>
<%= system.name %>.vm.hostname = '<%= system.get_hostname %>'
<% if !(@options.has_key? :esxinohostname) %>
<%= system.name %>.vm.hostname = '<%= system.get_hostname %>'
<% end %>
<%= system.name %>.vm.box = "<%= selected_module.module_path_name %>"
<%= system.name %>.vm.box_url = "<%= selected_module.attributes['esxi_url'].first %>"
<% else %>

View File

@@ -57,10 +57,17 @@ def usage
ESXI OPTIONS:
--esxiuser [esxi_username]
--esxipass [esxi_password]
--esxi-url [esxi_api_url]
--esxi-hostname [esxi_api_url]
(ESXi hostname/IP)
--esxi-datastore [esxi_datastore]
--esxi-disktype [esxi_disktype]
--esxi-disktype [esxi_disktype]: 'thin', 'thick', or 'eagerzeroedthick'
(If unspecified, it will be set to 'thin')
--esxi-network [esxi_network_name]
(If it's not specified, the default is to use the first found)
--esxi-guest-nictype [esxi_nictype]: 'e1000', 'e1000e', 'vmxnet', 'vmxnet2', 'vmxnet3', 'Vlance', or 'Flexible'
(RISKY - Can cause VM to not respond)
--esxi-no-hostname
(Setting the hostname on some boxes can cause 'vagrant up' to fail if the network configuration wasn't previously cleaned up.)
COMMANDS:
run, r: Builds project and then builds the VMs
@@ -461,9 +468,12 @@ opts = GetoptLong.new(
['--retries', GetoptLong::REQUIRED_ARGUMENT],
['--esxiuser', GetoptLong::REQUIRED_ARGUMENT],
['--esxipass', GetoptLong::REQUIRED_ARGUMENT],
['--esxi-url', GetoptLong::REQUIRED_ARGUMENT],
['--esxi-hostname', GetoptLong::REQUIRED_ARGUMENT],
['--esxi-datastore', GetoptLong::REQUIRED_ARGUMENT],
['--esxi-network', GetoptLong::REQUIRED_ARGUMENT],
['--esxi-disktype', GetoptLong::REQUIRED_ARGUMENT],
['--esxi-guest-nictype', GetoptLong::REQUIRED_ARGUMENT],
['--esxi-no-hostname', GetoptLong::NO_ARGUMENT],
)
scenario = SCENARIO_XML
@@ -564,9 +574,9 @@ opts.each do |opt, arg|
when '--esxipass'
Print.info "ESXi Password : ********"
options[:esxipass] = arg
when '--esxi-url'
Print.info "ESXi host url : #{arg}"
options[:esxi_url] = arg
when '--esxi-hostname'
Print.info "ESXi host : #{arg}"
options[:esxi_host] = arg
when '--esxi-datastore'
Print.info "ESXi datastore: #{arg}"
options[:esxidatastore] = arg
@@ -574,8 +584,27 @@ opts.each do |opt, arg|
Print.info "ESXi Network Name : #{arg}"
options[:esxinetwork] = arg
when '--esxi-disktype'
Print.info "ESXi disk type : #{arg}"
options[:esxidisktype] = arg
if ['thin', 'thick', 'eagerzeroedthick'].include? arg
Print.info "ESXi disk type : #{arg}"
options[:esxidisktype] = arg
else
Print.warn "ESXi disk type : #{arg} not supported"
Print.warn "ESXi disk type only supports: 'thin', 'thick', or 'eagerzeroedthick'"
Print.info "Defaulting to ESXi disk type: 'thin'"
options[:esxidisktype] = 'thin'
end
when '--esxi-guest-nictype'
if ['e1000', 'e1000e', 'vmxnet','vmxnet2', 'vmxnet3', 'Vlance','Flexible'].include? arg
Print.info "ESXi Guest Nic type : #{arg}"
options[:esxiguestnictype] = arg
else
Print.warn "ESXi guest nic type : #{arg} not supported"
Print.warn "ESXi guest nic type only supports: 'e1000', 'e1000e', 'vmxnet','vmxnet2', 'vmxnet3', 'Vlance','Flexible'"
Print.info "Defaulting to ESXi disk type: 'thin'"
end
when '--esxi-no-hostname'
Print.info "Not setting hostnames when VMs are created"
options[:esxinohostname] = true
when '--no-tests'
Print.info "Not running post-provision tests"
options[:notests] = true