vagrant-uplift 0.2.1902.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/bin/console +13 -0
  3. data/bin/setup +8 -0
  4. data/lib/scripts/vagrant/uplift.vagrant.core/uplift.fix-second-network.ps1 +59 -0
  5. data/lib/scripts/vagrant/uplift.vagrant.dc12/dc.dsc.ps1 +128 -0
  6. data/lib/scripts/vagrant/uplift.vagrant.dc12/dc.replica.dsc.ps1 +117 -0
  7. data/lib/scripts/vagrant/uplift.vagrant.dc12/dc.users.dsc.ps1 +147 -0
  8. data/lib/scripts/vagrant/uplift.vagrant.dc12/tests/dc.dsc.Tests.ps1 +165 -0
  9. data/lib/scripts/vagrant/uplift.vagrant.dcjoin/dc.join.dsc.ps1 +125 -0
  10. data/lib/scripts/vagrant/uplift.vagrant.dcjoin/dc.join.hostname.ps1 +13 -0
  11. data/lib/scripts/vagrant/uplift.vagrant.dcjoin/tests/dc.join.dsc.Tests.ps1 +12 -0
  12. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/shared/sp.helpers.ps1 +155 -0
  13. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2013.dsc.ps1 +248 -0
  14. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2013.post_setup.dsc.ps1 +117 -0
  15. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2016.dsc.ps1 +246 -0
  16. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2016.farm-only.dsc.ps1 +281 -0
  17. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2016.info.ps1 +36 -0
  18. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2016.post_setup.dsc.ps1 +125 -0
  19. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2016.pre_setup1.dsc.ps1 +28 -0
  20. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/sp2016.pre_setup2.dsc.ps1 +75 -0
  21. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/tests/sp2013.dsc.wfe.Tests.ps1 +68 -0
  22. data/lib/scripts/vagrant/uplift.vagrant.sharepoint/tests/sp2016.dsc.wfe.Tests.ps1 +68 -0
  23. data/lib/scripts/vagrant/uplift.vagrant.sql12/sql.complete.dsc.ps1 +186 -0
  24. data/lib/scripts/vagrant/uplift.vagrant.sql12/sql.dsc.ps1 +66 -0
  25. data/lib/scripts/vagrant/uplift.vagrant.sql12/sql.optimize.dsc.ps1 +50 -0
  26. data/lib/scripts/vagrant/uplift.vagrant.sql12/sql.prepare.dsc.ps1 +60 -0
  27. data/lib/scripts/vagrant/uplift.vagrant.sql12/tests/sql.dsc.Tests.ps1 +23 -0
  28. data/lib/scripts/vagrant/uplift.vagrant.sql12/tests/sql12.dsc.Tests.ps1 +45 -0
  29. data/lib/scripts/vagrant/uplift.vagrant.sql12/tests/sql16.dsc.Tests.ps1 +22 -0
  30. data/lib/scripts/vagrant/uplift.vagrant.visual_studio13/tests/vs13.dsc.Tests.ps1 +61 -0
  31. data/lib/scripts/vagrant/uplift.vagrant.visual_studio13/vs13.dsc.post_deploy.ps1 +32 -0
  32. data/lib/scripts/vagrant/uplift.vagrant.visual_studio13/vs13.dsc.ps1 +69 -0
  33. data/lib/scripts/vagrant/uplift.vagrant.visual_studio17/tests/vs17.dsc.Tests.ps1 +61 -0
  34. data/lib/scripts/vagrant/uplift.vagrant.visual_studio17/vs17.dsc.post_deploy.ps1 +34 -0
  35. data/lib/scripts/vagrant/uplift.vagrant.visual_studio17/vs17.dsc.ps1 +134 -0
  36. data/lib/scripts/vagrant/uplift.vagrant.win12soe/soe.dsc.ps1 +115 -0
  37. data/lib/scripts/vagrant/uplift.vagrant.win12soe/soe.shortcuts.dsc.ps1 +41 -0
  38. data/lib/scripts/vagrant/uplift.vagrant.win12soe/tests/soe.dsc.modules.Tests.ps1 +71 -0
  39. data/lib/scripts/vagrant/uplift.vagrant.win12soe/tests/soe.dsc.os.Tests.ps1 +89 -0
  40. data/lib/vagrant-uplift.rb +8 -0
  41. data/lib/vagrant-uplift/config_builder.rb +819 -0
  42. data/lib/vagrant-uplift/log.rb +146 -0
  43. data/lib/vagrant-uplift/plugin-vagrant-uplift-checkpoint.rb +41 -0
  44. data/lib/vagrant-uplift/plugin.rb +16 -0
  45. data/lib/vagrant-uplift/version.rb +10 -0
  46. metadata +131 -0
@@ -0,0 +1,134 @@
1
+ # fail on errors and include uplift helpers
2
+ $ErrorActionPreference = "Stop"
3
+
4
+ Import-Module Uplift.Core
5
+
6
+ Write-UpliftMessage "Installing Visual Studio..."
7
+ Write-UpliftEnv
8
+
9
+ $execPath = Get-UpliftEnvVariable "UPLF_VS_EXECUTABLE_PATH"
10
+ Write-UpliftMessage "Using VS install file: $execPath"
11
+
12
+ $vsPackageIdsValue = Get-UpliftEnvVariable "UPLF_VS_PACKAGE_IDS"
13
+
14
+ Write-UpliftMessage "Using product name: $productName "
15
+ Write-UpliftMessage "Using package IDs:"
16
+ Write-UpliftMessage " - $vsPackageIdsValue"
17
+
18
+ $expectPackageCount = [int](Get-UpliftEnvVariable "UPLF_VS_PACKAGE_COUNT")
19
+
20
+ Write-UpliftMessage "Using VS install file: $execPath"
21
+ Write-UpliftMessage "Expecting $expectPackageCount packages installed"
22
+
23
+ $installLogFolder = $env:TEMP
24
+ $installLogFilter = "dd_setup*_*_*"
25
+ $vs17LogsFilter = "dd_*"
26
+
27
+ $enterprisePackageName = "Microsoft.VisualStudio.Product.Enterprise"
28
+
29
+ Write-UpliftMessage "Cleaning up previous logs, filter: $vs17LogsFilter, path: $installLogFolder"
30
+ $logFiles = Get-ChildItem $installLogFolder -Filter $vs17LogsFilter
31
+ Write-UpliftMessage "Found $($logFiles.Count) files, will remove them"
32
+
33
+ $logFiles | foreach { Remove-Item -Path $_.FullName }
34
+
35
+ # TODO, move layout and other configs into variables
36
+ # --noWeb fails with the following errors so that it is not possible to make fully offline install
37
+ # * Package 'Microsoft.VisualStudio.Branding.Enterprise,version=15.6.27413.0,language=en-US' failed to download from
38
+ # * Package 'Microsoft.VisualStudio.MinShell.Resources,version=15.7.27703.2018,language=en-US' failed to download from
39
+
40
+ # https://docs.microsoft.com/en-us/visualstudio/install/create-a-network-installation-of-visual-studio
41
+ # https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio
42
+ # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community?view=vs-2017
43
+
44
+ $splitOptions = [System.StringSplitOptions]::RemoveEmptyEntries
45
+ $packageIds = $vsPackageIdsValue.Split(";", $splitOptions)
46
+
47
+ $workloadArgument = @()
48
+
49
+ foreach($packageId in $packageIds) {
50
+ $workloadArgument += ("--add " + $packageId)
51
+ }
52
+
53
+ $workloadCmd = [string]::Join(" ", $workloadArgument )
54
+ Write-UpliftMessage " - workloadCmd: $workloadCmd"
55
+
56
+ Write-UpliftMessage "Executing install..."
57
+ Write-UpliftMessage " - path: $execPath"
58
+
59
+ $modifyCmd = ""
60
+ $installPath = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise"
61
+ if(Test-Path $installPath) {
62
+ Write-UpliftMessage "VS install path exists, adding --modify flag"
63
+ $modifyCmd = "modify --installPath ""$installPath"" "
64
+ Write-UpliftMessage " - cmd: $modifyCmd"
65
+ }
66
+
67
+ $finalCmd = "$modifyCmd $workloadCmd --quiet --wait"
68
+ Write-UpliftMessage "Final arg cmd:"
69
+ Write-UpliftMessage " - cmd: $finalCmd "
70
+
71
+ $process = Start-Process -FilePath $execPath `
72
+ -ArgumentList "$finalCmd" `
73
+ -Wait `
74
+ -PassThru
75
+
76
+ # logs will be at %TEMP% folder
77
+ # C:\Users\vagrant\AppData\Local\Temp
78
+ # a bunch of
79
+ # - dd_bootstrapper
80
+ # - dd_client
81
+ # - dd_service
82
+ # we might need to check these files in order to parse errors
83
+ $exitCode = $process.ExitCode;
84
+ Write-UpliftMessage "Exit code was: $exitCode"
85
+
86
+ Write-UpliftMessage "Checking packages installed, filter: $installLogFilter, path: $installLogFolder"
87
+ $files = Get-ChildItem $installLogFolder -Filter $installLogFilter
88
+ Write-UpliftMessage "Found $($files.Count) files"
89
+
90
+ foreach($file in $files) {
91
+ Write-UpliftMessage $file.FullName
92
+ }
93
+
94
+ if($files.Count -le $expectPackageCount) {
95
+ Write-UpliftMessage "WARN - less than $expectPackageCount packages, we might have VS2017 installed wrong or it could be install on top"
96
+ } else {
97
+ Write-UpliftMessage "INFO - more than $expectPackageCount packages, we might have VS2017 installed right"
98
+ }
99
+
100
+ $mainPackage = Get-ChildItem $installLogFolder -Filter "dd_setup_*_*_$enterprisePackageName*"
101
+
102
+ if($mainPackage.Count -le 0) {
103
+ Write-UpliftMessage "WARN - can't find package $enterprisePackageName, we might have VS2017 installed wrong"
104
+ } else {
105
+ Write-UpliftMessage "INGO - CAN find package $enterprisePackageName, we might have VS2017 installed right"
106
+ }
107
+
108
+ # printing error file
109
+ $errorFilePath = "$installLogFolder\dd_setup_**_errors.log"
110
+
111
+ Write-UpliftMessage "Checking error log: $errorFilePath"
112
+ if (Test-Path $errorFilePath ) {
113
+ $realErrorFilePath = Resolve-Path $errorFilePath
114
+ Write-UpliftMessage "Reading error file: $realErrorFilePath"
115
+
116
+ $errorContent = Get-Content $realErrorFilePath
117
+ if ($errorContent.Count -eq 0) {
118
+ Write-UpliftMessage "No error are found, all looks promising!"
119
+ } else {
120
+ Write-UpliftMessage "Errors output:"
121
+ Write-UpliftMessage $errorContent
122
+
123
+ exit -1
124
+ }
125
+ } else {
126
+ Write-UpliftMessage "Can't find errors file: $errorFilePath"
127
+ }
128
+
129
+ if ($exitCode -ne 0 -and $exitCode -ne 3010) {
130
+ Write-UpliftMessage "Failed to install VS2017, exit code: $exitCode";
131
+ exit $exitCode;
132
+ }
133
+
134
+ exit 0
@@ -0,0 +1,115 @@
1
+ # fail on errors and include uplift helpers
2
+ $ErrorActionPreference = "Stop"
3
+
4
+ Import-Module Uplift.Core
5
+
6
+ Write-UpliftMessage "Running windows SOE config..."
7
+ Write-UpliftEnv
8
+
9
+ Write-UpliftMessage "Disabling Firewalls..."
10
+ Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
11
+
12
+ Configuration Configure_WinSOE {
13
+
14
+ Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
15
+
16
+ Import-DscResource -ModuleName 'xActiveDirectory' -ModuleVersion '2.17.0.0'
17
+ Import-DscResource -ModuleName 'xNetworking' -ModuleVersion '5.5.0.0'
18
+ Import-DscResource -ModuleName 'ComputerManagementDsc' -ModuleVersion "6.1.0.0"
19
+
20
+ Import-DSCResource -Module xSystemSecurity
21
+
22
+ Node localhost
23
+ {
24
+ LocalConfigurationManager
25
+ {
26
+ ConfigurationMode = 'ApplyOnly'
27
+ RebootNodeIfNeeded = $false
28
+ RefreshMode = "Push"
29
+ }
30
+
31
+ User Vagrant {
32
+ UserName = "vagrant"
33
+ Disabled = $false
34
+ PasswordChangeRequired = $false
35
+ PasswordNeverExpires = $true
36
+ }
37
+
38
+ TimeZone TimeZone
39
+ {
40
+ IsSingleInstance = 'Yes'
41
+ TimeZone = $Node.TimeZoneName
42
+ }
43
+
44
+ WindowsFeature ADDSInstall
45
+ {
46
+ Ensure = "Present"
47
+ Name = "AD-Domain-Services"
48
+ }
49
+
50
+ WindowsFeature ADDSRSAT
51
+ {
52
+ Ensure = "Present"
53
+ Name = "RSAT-ADDS-Tools"
54
+ }
55
+
56
+ WindowsFeature RSAT
57
+ {
58
+ Ensure = "Present"
59
+ Name = "RSAT"
60
+ }
61
+
62
+ Registry WindowsUpdate_NoAutoUpdate
63
+ {
64
+ Ensure = "Present"
65
+ Key = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
66
+ ValueName = "NoAutoUpdate"
67
+ ValueData = 1
68
+ ValueType = "DWord"
69
+ }
70
+
71
+ Registry WindowsUpdate_AUOptions
72
+ {
73
+ Ensure = "Present"
74
+ Key = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
75
+ ValueName = "AUOptions"
76
+ ValueData = 2
77
+ ValueType = "DWord"
78
+ }
79
+
80
+ Registry Windows_RemoteConnections
81
+ {
82
+ Ensure = "Present"
83
+ Key = "HKLM:System\CurrentControlSet\Control\Terminal Server"
84
+ ValueName = "fDenyTSConnections"
85
+ ValueData = 0
86
+ ValueType = "DWord"
87
+ }
88
+
89
+ xIEEsc Disable_IEEsc
90
+ {
91
+ IsEnabled = $false
92
+ UserRole = "Administrators"
93
+ }
94
+ }
95
+ }
96
+
97
+
98
+ $config = @{
99
+ AllNodes = @(
100
+ @{
101
+ NodeName = 'localhost'
102
+ PSDscAllowPlainTextPassword = $true
103
+ RetryCount = 10
104
+ RetryIntervalSec = 30
105
+
106
+ TimeZoneName = ( Get-UpliftEnvVariable "UPLF_SOE_TIME_ZONE_NAME" "" 'AUS Eastern Standard Time' )
107
+ }
108
+ )
109
+ }
110
+
111
+
112
+ $configuration = Get-Command Configure_WinSOE
113
+ Start-UpliftDSCConfiguration $configuration $config -ExpectInDesiredState $True
114
+
115
+ exit 0
@@ -0,0 +1,41 @@
1
+ # fail on errors and include uplift helpers
2
+ $ErrorActionPreference = "Stop"
3
+
4
+ Import-Module Uplift.Core
5
+
6
+ Write-UpliftMessage "Running DSC Configure_Shortcuts..."
7
+
8
+ Configuration SOE_Shortcuts
9
+ {
10
+ Import-DscResource -ModuleName DSCR_Shortcut -ModuleVersion '1.3.7'
11
+
12
+ $desktopPath = [Environment]::GetFolderPath("Desktop")
13
+
14
+ cShortcut IE_Desktop
15
+ {
16
+ Path = "$desktopPath\IE.lnk"
17
+ Target = "C:\Program Files\Internet Explorer\iexplore.exe"
18
+
19
+ }
20
+
21
+ cShortcut PowerShell_ISE_Desktop
22
+ {
23
+ Path = "$desktopPath\PowerShellISE.lnk"
24
+ Target = "%windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe"
25
+ WorkingDirectory = '%HOMEDRIVE%%HOMEPATH%'
26
+
27
+ }
28
+
29
+ cShortcut PowerShell_6_Desktop
30
+ {
31
+ Path = "$desktopPath\PowerShell6.lnk"
32
+ Target = "C:\Program Files\PowerShell\6\pwsh.exe"
33
+ Arguments = "-WorkingDirectory ~"
34
+
35
+ }
36
+ }
37
+
38
+ $configuration = Get-Command SOE_Shortcuts
39
+ Start-UpliftDSCConfiguration $configuration $config -ExpectInDesiredState $True
40
+
41
+ exit 0
@@ -0,0 +1,71 @@
1
+ 
2
+ Describe 'PowerShell DCS' {
3
+
4
+ Context "Modules" {
5
+
6
+ It 'cChoco' {
7
+ Get-Module -Name cChoco -ListAvailable | Should BeLike "cChoco"
8
+ }
9
+
10
+ It 'cFirewall' {
11
+ Get-Module -Name cFirewall -ListAvailable | Should BeLike "cFirewall"
12
+ }
13
+
14
+ It 'SharePointDSC' {
15
+ Get-Module -Name SharePointDSC -ListAvailable | Should BeLike "SharePointDSC"
16
+ }
17
+
18
+ It 'MS_xVisualStudio' {
19
+ Get-Module -Name MS_xVisualStudio -ListAvailable | Should BeLike "MS_xVisualStudio"
20
+ }
21
+
22
+ It 'xActiveDirectory' {
23
+ Get-Module -Name xActiveDirectory -ListAvailable | Should BeLike "xActiveDirectory"
24
+ }
25
+
26
+ It 'xSQLServer' {
27
+ Get-Module -Name xSQLServer -ListAvailable | Should BeLike "xSQLServer"
28
+ }
29
+
30
+ It 'xDSCFirewall' {
31
+ Get-Module -Name xDSCFirewall -ListAvailable | Should BeLike "xDSCFirewall"
32
+ }
33
+
34
+ It 'xNetworking' {
35
+ Get-Module -Name xNetworking -ListAvailable | Should BeLike "xNetworking"
36
+ }
37
+
38
+ It 'xTimeZone' {
39
+ Get-Module -Name xTimeZone -ListAvailable | Should BeLike "xTimeZone"
40
+ }
41
+
42
+ It 'xWebAdministration' {
43
+ Get-Module -Name xWebAdministration -ListAvailable | Should BeLike "xWebAdministration"
44
+ }
45
+
46
+ It 'xPendingReboot' {
47
+ Get-Module -Name xPendingReboot -ListAvailable | Should BeLike "xPendingReboot"
48
+ }
49
+
50
+ It 'xComputerManagement' {
51
+ Get-Module -Name xComputerManagement -ListAvailable | Should BeLike "xComputerManagement"
52
+ }
53
+
54
+ It 'Pester' {
55
+ Get-Module -Name Pester -ListAvailable | Should BeLike "Pester"
56
+ }
57
+
58
+ It 'xSystemSecurity' {
59
+ Get-Module -Name xSystemSecurity -ListAvailable | Should BeLike "xSystemSecurity"
60
+ }
61
+
62
+ It 'DSCR_Shortcut' {
63
+ Get-Module -Name DSCR_Shortcut -ListAvailable | Should BeLike "DSCR_Shortcut"
64
+ }
65
+
66
+ It 'PSWindowsUpdate' {
67
+ Get-Module -Name PSWindowsUpdate -ListAvailable | Should BeLike "PSWindowsUpdate"
68
+ }
69
+
70
+ }
71
+ }
@@ -0,0 +1,89 @@
1
+ Describe 'OS' {
2
+
3
+ Context "Settings" {
4
+ # timezone is set to AU
5
+ It 'AUS Eastern Standard Time' {
6
+ ([System.TimeZone]::CurrentTimeZone).StandardName | Should BeLike "AUS Eastern Standard Time"
7
+ }
8
+
9
+ # auto-update settings
10
+ It 'NoAutoUpdate = 1' {
11
+
12
+ $regKey = "HKLM:SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU"
13
+
14
+ (Get-Item $regKey).GetValue('NoAutoUpdate') | Should Be 1
15
+ }
16
+
17
+ It 'AUOptions = 1' {
18
+ $regKey = "HKLM:SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU"
19
+
20
+ (Get-Item $regKey).GetValue('AUOptions') | Should Be 2
21
+ }
22
+ }
23
+
24
+ Context "Features" {
25
+ It 'AD-Domain-Services' {
26
+ (Get-WindowsFeature AD-Domain-Services).InstallState | Should BeLike "Installed"
27
+ }
28
+
29
+ It 'RSAT-ADDS-Tools' {
30
+ (Get-WindowsFeature RSAT-ADDS-Tools).InstallState | Should BeLike "Installed"
31
+ }
32
+
33
+ It 'RSAT' {
34
+ (Get-WindowsFeature RSAT).InstallState | Should BeLike "Installed"
35
+ }
36
+ }
37
+
38
+ Context "Firewall" {
39
+ It 'domain is OFF' {
40
+ $FWProfile = "DomainProfile"
41
+ $Actual = Invoke-Command -ScriptBlock { (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\$FWProfile" -Name EnableFirewall).EnableFirewall }
42
+
43
+ $Actual | Should Be 0
44
+
45
+ }
46
+
47
+ It 'public is OFF' {
48
+ $FWProfile = "PublicProfile"
49
+ $Actual = Invoke-Command -ScriptBlock { (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\$FWProfile" -Name EnableFirewall).EnableFirewall }
50
+
51
+ $Actual | Should Be 0
52
+ }
53
+
54
+ It 'private is OFF' {
55
+ $FWProfile = "StandardProfile"
56
+ $Actual = Invoke-Command -ScriptBlock { (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\$FWProfile" -Name EnableFirewall).EnableFirewall }
57
+
58
+ $Actual | Should Be 0
59
+ }
60
+ }
61
+
62
+ Context "Tools" {
63
+
64
+ It 'choco is installed' {
65
+ get-command choco | Should BeLike "*choco.exe*"
66
+ }
67
+
68
+ It '7zip is installed' {
69
+ get-command 7z | Should BeLike "*7z.exe*"
70
+ }
71
+
72
+ It 'git is installed' {
73
+ get-command git.exe | Should BeLike "*git.exe*"
74
+ }
75
+
76
+ It 'curl is installed' {
77
+ get-command curl.exe | Should BeLike "*curl.exe*"
78
+ }
79
+
80
+ It 'wget is installed' {
81
+ get-command wget.exe | Should BeLike "*wget.exe*"
82
+ }
83
+
84
+ It 'pwsh is installed' {
85
+ get-command pwsh.exe | Should BeLike "*pwsh.exe*"
86
+ }
87
+ }
88
+
89
+ }