24
									
								
								build.ps1
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								build.ps1
									
									
									
									
									
								
							| @@ -25,9 +25,6 @@ | |||||||
| .PARAMETER PackerPath | .PARAMETER PackerPath | ||||||
|   The full path to the packer executable. Default is C:\Hashicorp\packer.exe |   The full path to the packer executable. Default is C:\Hashicorp\packer.exe | ||||||
|  |  | ||||||
| .PARAMETER PackerOnly |  | ||||||
|   This switch skips deploying boxes with vagrant after being built by packer |  | ||||||
|  |  | ||||||
| .PARAMETER VagrantOnly | .PARAMETER VagrantOnly | ||||||
|   This switch skips building packer boxes and instead downloads from Vagrant Cloud |   This switch skips building packer boxes and instead downloads from Vagrant Cloud | ||||||
|  |  | ||||||
| @@ -51,7 +48,6 @@ Param( | |||||||
|   [ValidateSet('virtualbox', 'vmware_desktop')] |   [ValidateSet('virtualbox', 'vmware_desktop')] | ||||||
|   [string]$ProviderName, |   [string]$ProviderName, | ||||||
|   [string]$PackerPath = 'C:\Hashicorp\packer.exe', |   [string]$PackerPath = 'C:\Hashicorp\packer.exe', | ||||||
|   [switch]$PackerOnly, |  | ||||||
|   [switch]$VagrantOnly |   [switch]$VagrantOnly | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -190,7 +186,6 @@ function preflight_checks { | |||||||
|       break |       break | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   if (!($PackerOnly)) { |  | ||||||
|   Write-Host '[preflight_checks] Checking if Vagrant is installed' |   Write-Host '[preflight_checks] Checking if Vagrant is installed' | ||||||
|   check_vagrant |   check_vagrant | ||||||
|  |  | ||||||
| @@ -238,7 +233,6 @@ function preflight_checks { | |||||||
|       break |       break | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   } |  | ||||||
|   Write-Host '[preflight_checks] Finished.' |   Write-Host '[preflight_checks] Finished.' | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -268,11 +262,11 @@ function move_boxes { | |||||||
|   Write-Host "[move_boxes] Running.." |   Write-Host "[move_boxes] Running.." | ||||||
|   Move-Item -Path $DL_DIR\Packer\*.box -Destination $DL_DIR\Boxes |   Move-Item -Path $DL_DIR\Packer\*.box -Destination $DL_DIR\Boxes | ||||||
|   if (-Not (Test-Path "$DL_DIR\Boxes\windows_10_$PackerProvider.box")) { |   if (-Not (Test-Path "$DL_DIR\Boxes\windows_10_$PackerProvider.box")) { | ||||||
|     Write-Error "Windows 10 box is missing from the Boxes directory. Quitting." |     Write-Error "Windows 10 box is missing from the Boxes directory. Qutting." | ||||||
|     break |     break | ||||||
|   } |   } | ||||||
|   if (-Not (Test-Path "$DL_DIR\Boxes\windows_2016_$PackerProvider.box")) { |   if (-Not (Test-Path "$DL_DIR\Boxes\windows_2016_$PackerProvider.box")) { | ||||||
|     Write-Error "Windows 2016 box is missing from the Boxes directory. Quitting." |     Write-Error "Windows 2016 box is missing from the Boxes directory. Qutting." | ||||||
|     break |     break | ||||||
|   } |   } | ||||||
|   Write-Host "[move_boxes] Finished." |   Write-Host "[move_boxes] Finished." | ||||||
| @@ -393,9 +387,8 @@ if (!($VagrantOnly)) { | |||||||
|   move_boxes |   move_boxes | ||||||
| } | } | ||||||
|  |  | ||||||
| if (!($PackerOnly)) { | # Vagrant up each box and attempt to reload one time if it fails | ||||||
|   # Vagrant up each box and attempt to reload one time if it fails | forEach ($VAGRANT_HOST in $LAB_HOSTS) { | ||||||
|   forEach ($VAGRANT_HOST in $LAB_HOSTS) { |  | ||||||
|   Write-Host "[main] Running vagrant_up_host for: $VAGRANT_HOST" |   Write-Host "[main] Running vagrant_up_host for: $VAGRANT_HOST" | ||||||
|   $result = vagrant_up_host -VagrantHost $VAGRANT_HOST |   $result = vagrant_up_host -VagrantHost $VAGRANT_HOST | ||||||
|   Write-Host "[main] vagrant_up_host finished. Exitcode: $result" |   Write-Host "[main] vagrant_up_host finished. Exitcode: $result" | ||||||
| @@ -413,9 +406,8 @@ if (!($PackerOnly)) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   Write-Host "[main] Finished for: $VAGRANT_HOST" |   Write-Host "[main] Finished for: $VAGRANT_HOST" | ||||||
|   } |  | ||||||
|  |  | ||||||
|   Write-Host "[main] Running post_build_checks" |  | ||||||
|   post_build_checks |  | ||||||
|   Write-Host "[main] Finished post_build_checks" |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | Write-Host "[main] Running post_build_checks" | ||||||
|  | post_build_checks | ||||||
|  | Write-Host "[main] Finished post_build_checks" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dustin Lee
					Dustin Lee