-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vagrant: Add Windows Server 2022 option to VPC (#3257)
* Add windows 2022 to VPC Vagrant performance tweak Vagrantfile alignments. Comment fix. Vagrant update Vagrantfiles * Test no warning * Revert warnings test * Test * Update task name
- Loading branch information
1 parent
43edbd9
commit 5eb5d44
Showing
4 changed files
with
87 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# Runs Powershell as an administator and does the following: | ||
# - Gets/executes an Ansible provided script that configures WinRM to allow Ansible to communicate over it. | ||
# - Resizes the disk to ~100GB, in line with the 'disksize.size = 100GB' option in the config below | ||
|
||
$script = <<SCRIPT | ||
Start-Process powershell -Verb runAs | ||
wget https://raw.githubusercontent.com/ansible/ansible-documentation/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 -OutFile .\\ConfigureRemotingForAnsible.ps1 | ||
.\\ConfigureRemotingForAnsible.ps1 -CertValidityDays 9999 | ||
.\\ConfigureRemotingForAnsible.ps1 -EnableCredSSP | ||
.\\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert | ||
.\\ConfigureRemotingForAnsible.ps1 -SkipNetworkProfileCheck | ||
# Retrieving disk's current size | ||
$currentDiskSize =(Get-Partition -DriveLetter c | select Size) | ||
$currentDiskSize =($currentDiskSize -replace "[^0-9]" , "") | ||
# The size the disk should be, in bytes (130GB) | ||
$diskSizeBoundary = 139586437120 | ||
# Changing the disksize to max supported size (~130GB) | ||
if ([long]$currentDiskSize -lt $diskSizeBoundary) { | ||
echo "Resizing disk to max size" | ||
$size = (Get-PartitionSupportedSize -DriveLetter c); Resize-Partition -DriveLetter c -Size $size.SizeMax | ||
}else { | ||
echo "Disk is already at max size" | ||
} | ||
Start-Process cmd -Verb runAs | ||
winrm set winrm/config/service '@{AllowUnencrypted="true"}' | ||
SCRIPT | ||
|
||
# 2 = version of configuration file for Vagrant 1.1+ leading up to 2.0.x | ||
Vagrant.configure("2") do |config| | ||
|
||
config.vm.define :adoptopenjdkW2022 do |adoptopenjdkW2022| | ||
adoptopenjdkW2022.vm.box = "gusztavvargadr/windows-server-2022-standard" | ||
adoptopenjdkW2022.vm.hostname = "adoptopenjdkW2022" | ||
adoptopenjdkW2022.vm.communicator = "winrm" | ||
adoptopenjdkW2022.vm.synced_folder ".", "/vagrant" | ||
adoptopenjdkW2022.vm.network :private_network, type: "dhcp" | ||
adoptopenjdkW2022.vm.provision "shell", inline: $script, privileged: false | ||
adoptopenjdkW2022.disksize.size = '130GB' | ||
end | ||
config.vm.provider "virtualbox" do |v| | ||
v.gui = false | ||
v.memory = 8192 | ||
v.cpus = 2 | ||
v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] | ||
end | ||
end |