vagrant-uplift 0.2.1902.18

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5d87292c8668a405ab0d16e13e3fbef281058c77a5976bb4461749bdb7a2f032
4
+ data.tar.gz: cea9495057318c1f2a826d899d62b2e185b7f103a5633ae2e81db8ecc9807187
5
+ SHA512:
6
+ metadata.gz: db4236e3ca8e99f457939fa64133d7274579bc67fcde29082f91374043d42ebcb2a7a8750848c1a0a43b32327e1ae14d769653927299f13f1a6b3943549216f5
7
+ data.tar.gz: 49cbd51d6c8c788da147a1a42f8f8a0bc268b33a745777e197db8fff8b88163af3d7666a3d39b4511acb5f629100eebbc05bb506ea10d5959b9d81da00b5bb13
data/bin/console ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+
5
+ # You can add fixtures and/or initialization code here to make experimenting
6
+ # with your gem easier. You can also use a different console, if you like.
7
+
8
+ # (If you use this, don't forget to add pry to your Gemfile!)
9
+ # require "pry"
10
+ # Pry.start
11
+
12
+ require "irb"
13
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,59 @@
1
+ param ([String] $ip, [String] $dns)
2
+
3
+ # fail on errors and include uplift helpers
4
+ $ErrorActionPreference = "Stop"
5
+
6
+ Import-Module Uplift.Core
7
+
8
+ Write-UpliftMessage "Fixing up network settings..."
9
+ Write-UpliftEnv
10
+
11
+ # if (Test-Path C:\Users\vagrant\enable-winrm-after-customization.bat) {
12
+ # Write-UpliftMessage "Nothing to do in vCloud."
13
+ # exit 0
14
+ # }
15
+ # if (! (Test-Path 'C:\Program Files\VMware\VMware Tools')) {
16
+ # Write-UpliftMessage "Nothing to do for other providers than VMware."
17
+ # exit 0
18
+ # }
19
+
20
+ $subnet = $ip -replace "\.\d+$", ""
21
+
22
+ Write-UpliftMessage " - ip : $ip"
23
+ Write-UpliftMessage " - subnet: $subnet"
24
+
25
+ $name = (Get-NetIPAddress -AddressFamily IPv4 `
26
+ | Where-Object -FilterScript { ($_.IPAddress).StartsWith($subnet) } `
27
+ ).InterfaceAlias
28
+
29
+ if (!$name) {
30
+ $name = (Get-NetIPAddress -AddressFamily IPv4 `
31
+ | Where-Object -FilterScript { ($_.IPAddress).StartsWith("169.254.") } `
32
+ ).InterfaceAlias
33
+ }
34
+
35
+ if ($name) {
36
+ Write-UpliftMessage "Set IP address to $ip of interface $name"
37
+ & netsh.exe int ip set address "$name" static $ip 255.255.255.0 "$subnet.1"
38
+
39
+ Confirm-UpliftExitCode $LASTEXITCODE "Cannot set IP address to $ip of interface $name" @(0,1)
40
+
41
+ if ($dns) {
42
+ Write-UpliftMessage "Set DNS server address to $dns of interface $name"
43
+ & netsh.exe interface ipv4 add dnsserver "$name" address=$dns index=1
44
+
45
+ Confirm-UpliftExitCode $LASTEXITCODE "Cannot set DNS server address to $dns of interface $name" @(0,1)
46
+ }
47
+ } else {
48
+
49
+ Write-UpliftMessage "Running ipconfig /all"
50
+ ipconfig /all
51
+ Confirm-UpliftExitCode $LASTEXITCODE "Cannot run ipconfig"
52
+
53
+ $errorMessage = "Could not find a interface with subnet $subnet.xx"
54
+
55
+ Write-UpliftMessage $errorMessage
56
+ throw $errorMessage
57
+ }
58
+
59
+ exit 0
@@ -0,0 +1,128 @@
1
+ # fail on errors and include uplift helpers
2
+ $ErrorActionPreference = "Stop"
3
+
4
+ Import-Module Uplift.Core
5
+
6
+ Write-UpliftMessage "Installing primary controller..."
7
+ Write-UpliftEnv
8
+
9
+ $domainName = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_NAME"
10
+ $domainAdminName = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_ADMIN_NAME"
11
+ $domainAdminPassword = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_ADMIN_PASSWORD"
12
+
13
+ $isPartOfDomain = (Get-CimInstance -Class Win32_ComputerSystem).PartOfDomain
14
+
15
+ if($isPartOfDomain -eq $True) {
16
+ Write-UpliftMessage "This computer is already part of domain. No domain join or reboot is required"
17
+ exit 0
18
+ }
19
+
20
+ Write-UpliftMessage "Fixing DC promo settings..."
21
+ Set-UpliftDCPromoSettings $domainAdminPassword
22
+
23
+ Configuration Install_DomainController {
24
+
25
+ Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
26
+ Import-DscResource -ModuleName 'xActiveDirectory'
27
+ Import-DscResource -ModuleName 'xNetworking'
28
+
29
+ Node localhost
30
+ {
31
+ $domainName = $Node.DomainName
32
+ $domainAdminName = $Node.DomainAdminName
33
+ $domainAdminPassword = $Node.DomainAdminPassword
34
+
35
+ $securePassword = ConvertTo-SecureString $domainAdminPassword -AsPlainText -Force
36
+ $domainAdminCreds = New-Object System.Management.Automation.PSCredential(
37
+ $domainAdminName,
38
+ $securePassword
39
+ )
40
+
41
+ $safeModeAdminCreds = $domainAdminCreds
42
+
43
+ LocalConfigurationManager
44
+ {
45
+ ConfigurationMode = 'ApplyOnly'
46
+ RebootNodeIfNeeded = $false
47
+ RefreshMode = "Push"
48
+ }
49
+
50
+ WindowsFeature DNS
51
+ {
52
+ Ensure = "Present"
53
+ Name = "DNS"
54
+ }
55
+
56
+ xDnsServerAddress DnsServerAddress
57
+ {
58
+ Address = '127.0.0.1'
59
+ InterfaceAlias = 'Ethernet'
60
+ AddressFamily = 'IPv4'
61
+ DependsOn = "[WindowsFeature]DNS"
62
+ }
63
+
64
+ WindowsFeature ADDSInstall
65
+ {
66
+ Ensure = "Present"
67
+ Name = "AD-Domain-Services"
68
+ }
69
+
70
+ WindowsFeature ADDSRSAT
71
+ {
72
+ Ensure = "Present"
73
+ Name = "RSAT-ADDS-Tools"
74
+ }
75
+
76
+ WindowsFeature RSAT
77
+ {
78
+ Ensure = "Present"
79
+ Name = "RSAT"
80
+ }
81
+
82
+ xADDomain PrimaryDomainController
83
+ {
84
+ DomainName = $domainName
85
+
86
+ # Windows 2016 fix
87
+ # http://vcloud-lab.com/entries/active-directory/powershell-dsc-xactivedirectory-error-a-netbios-domain-name-must-be-specified-
88
+ DomainNetBIOSName = $domainName.Split('.')[0]
89
+
90
+ DomainAdministratorCredential = $domainAdminCreds
91
+ SafemodeAdministratorPassword = $safeModeAdminCreds
92
+
93
+ DatabasePath = "C:\NTDS"
94
+ LogPath = "C:\NTDS"
95
+ SysvolPath = "C:\SYSVOL"
96
+
97
+ DependsOn = @(
98
+ "[WindowsFeature]ADDSInstall",
99
+ "[WindowsFeature]RSAT",
100
+ "[WindowsFeature]ADDSRSAT",
101
+ "[xDnsServerAddress]DnsServerAddress"
102
+ )
103
+ }
104
+ }
105
+ }
106
+
107
+ $config = @{
108
+ AllNodes = @(
109
+ @{
110
+ NodeName = 'localhost'
111
+
112
+ PSDscAllowDomainUser = $true
113
+ PSDscAllowPlainTextPassword = $true
114
+
115
+ RetryCount = 10
116
+ RetryIntervalSec = 30
117
+
118
+ DomainName = $domainName
119
+ DomainAdminName = $domainAdminName
120
+ DomainAdminPassword = $domainAdminPassword
121
+ }
122
+ )
123
+ }
124
+
125
+ $configuration = Get-Command Install_DomainController
126
+ Start-UpliftDSCConfiguration $configuration $config
127
+
128
+ exit 0
@@ -0,0 +1,117 @@
1
+ # fail on errors and include uplift helpers
2
+ $ErrorActionPreference = "Stop"
3
+
4
+ Import-Module Uplift.Core
5
+
6
+ Write-UpliftMessage "Installing replica domain controller..."
7
+ Write-UpliftEnv
8
+
9
+ $domainName = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_NAME"
10
+ $domainAdminName = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_ADMIN_NAME"
11
+ $domainAdminPassword = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_ADMIN_PASSWORD"
12
+
13
+ Write-UpliftMessage "Fixing DC promo settings..."
14
+ Set-UpliftDCPromoSettings $domainAdminPassword
15
+
16
+ # disable IP6 to ensure replica controller can be promoted
17
+ Write-UpliftMessage "Disabling IP6 interfaces..."
18
+ Disable-UpliftIP6Interface
19
+
20
+ Configuration Install_ReplicaDomainController {
21
+
22
+ Import-DscResource -ModuleName xActiveDirectory
23
+ Import-DscResource -ModuleName xNetworking
24
+
25
+ Node localhost
26
+ {
27
+ $domainName = $Node.DomainName
28
+ $domainAdminName = $Node.DomainAdminName
29
+ $domainAdminPassword = $Node.DomainAdminPassword
30
+
31
+ $securePassword = ConvertTo-SecureString $domainAdminPassword -AsPlainText -Force
32
+
33
+ $domainAdminCreds = New-Object System.Management.Automation.PSCredential($domainAdminName, $securePassword)
34
+ $safeModeAdminCreds = $domainAdminCreds
35
+ $dnsDelegationCreds = $domainAdminCreds
36
+
37
+ LocalConfigurationManager
38
+ {
39
+ ConfigurationMode = 'ApplyOnly'
40
+ RebootNodeIfNeeded = $false
41
+ RefreshMode = "Push"
42
+ }
43
+
44
+ # WindowsFeature DNS
45
+ # {
46
+ # Ensure = "Present"
47
+ # Name = "DNS"
48
+ # }
49
+
50
+ # xDnsServerAddress DnsServerAddress
51
+ # {
52
+ # Address = '127.0.0.1'
53
+ # InterfaceAlias = 'Ethernet'
54
+ # AddressFamily = 'IPv4'
55
+ # DependsOn = "[WindowsFeature]DNS"
56
+ # }
57
+
58
+ WindowsFeature ADDSInstall
59
+ {
60
+ Ensure = "Present"
61
+ Name = "AD-Domain-Services"
62
+ }
63
+
64
+ # WindowsFeature ADDSRSAT
65
+ # {
66
+ # Ensure = "Present"
67
+ # Name = "RSAT-ADDS-Tools"
68
+ # }
69
+
70
+ # WindowsFeature RSAT
71
+ # {
72
+ # Ensure = "Present"
73
+ # Name = "RSAT"
74
+ # }
75
+
76
+ xADDomainController ReplicaDomainController
77
+ {
78
+ DomainName = $domainName
79
+ # win16 fix
80
+ # http://vcloud-lab.com/entries/active-directory/powershell-dsc-xactivedirectory-error-a-netbios-domain-name-must-be-specified-
81
+ # DomainNetBIOSName = $domainName.Split('.')[0]
82
+
83
+ DomainAdministratorCredential = $domainAdminCreds
84
+ SafemodeAdministratorPassword = $safeModeAdminCreds
85
+
86
+ DependsOn = @(
87
+ "[WindowsFeature]ADDSInstall"
88
+ # "[WindowsFeature]RSAT",
89
+ # "[WindowsFeature]ADDSRSAT",
90
+ #"[xDnsServerAddress]DnsServerAddress"
91
+ )
92
+ }
93
+ }
94
+ }
95
+
96
+ $config = @{
97
+ AllNodes = @(
98
+ @{
99
+ NodeName = 'localhost'
100
+
101
+ PSDscAllowDomainUser = $true
102
+ PSDscAllowPlainTextPassword = $true
103
+
104
+ RetryCount = 10
105
+ RetryIntervalSec = 30
106
+
107
+ DomainName = $domainName
108
+ DomainAdminName = $domainAdminName
109
+ DomainAdminPassword = $domainAdminPassword
110
+ }
111
+ )
112
+ }
113
+
114
+ $configuration = Get-Command Install_ReplicaDomainController
115
+ Start-UpliftDSCConfiguration $configuration $config
116
+
117
+ exit 0
@@ -0,0 +1,147 @@
1
+ # fail on errors and include uplift helpers
2
+ $ErrorActionPreference = "Stop"
3
+
4
+ Import-Module Uplift.Core
5
+
6
+ Write-UpliftMessage "Installing new domain controller..."
7
+ Write-UpliftEnv
8
+
9
+ function WaitForAdServices($tries) {
10
+
11
+ # Somehow Win2016 might stuck at "Applying computer settings"
12
+ # that happens for several minutes, them all comes back
13
+ # could be a feature setup after DC/Defender removal, could be DNS thing
14
+
15
+ # so waiting for 5 minutes, and then fail
16
+ $user = "vagrant"
17
+
18
+ # 10 sec timout
19
+ $timeOut = 30000
20
+
21
+ # 10 minutes (6 * 10 sec => 10 times)
22
+ if($null -eq $tries) {
23
+ $tries = 6 * 10
24
+ }
25
+
26
+ $current = 0;
27
+ $hasError = $false
28
+
29
+ do {
30
+
31
+ try {
32
+ Write-UpliftMessage "[$current/$tries] waiting for AD services to come online, resolving user: [$user]"
33
+ $user = Get-ADUser "vagrant"
34
+
35
+ $hasError = $false
36
+
37
+ Write-UpliftMessage "[$current/$tries] No error! Nice!"
38
+ } catch {
39
+
40
+ Write-UpliftMessage "Failed with $_"
41
+ Write-UpliftMessage "Sleeping [$timeOut] milliseconds..."
42
+
43
+ $current++;
44
+ Start-Sleep -Milliseconds $timeOut
45
+ $hasError = $true
46
+ }
47
+
48
+ if($hasError -eq $false) {
49
+ break;
50
+ }
51
+
52
+ if($current -gt $tries) {
53
+ break;
54
+ }
55
+ }
56
+ while($hasError -eq $true)
57
+ }
58
+
59
+ $domainName = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_NAME"
60
+ $vagrantUserName = Get-UpliftEnvVariable "UPLF_VAGRANT_USER_NAME"
61
+ $vagrantUserPassword = Get-UpliftEnvVariable "UPLF_VAGRANT_USER_PASSWORD"
62
+ $domainUserName = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_ADMIN_NAME"
63
+ $domainUserPassword = Get-UpliftEnvVariable "UPLF_DC_DOMAIN_ADMIN_PASSWORD"
64
+
65
+ # ensuring AD services are up and running
66
+ Write-UpliftMessage "Starting NTDS service..."
67
+ start-service NTDS
68
+
69
+ Write-UpliftMessage "Starting ADWS service..."
70
+ start-service ADWS
71
+
72
+ # wait until AD comes up after reboot and applying setting
73
+ Write-UpliftMessage "Waiting for host to apply setting and make AD available...";
74
+ WaitForAdServices
75
+
76
+ $securePassword = ConvertTo-SecureString $domainUserPassword -AsPlainText -Force
77
+
78
+ $domainAdminCreds = New-Object System.Management.Automation.PSCredential(
79
+ $domainUserName,
80
+ $securePassword
81
+ )
82
+ $safeModeAdminCreds = $domainAdminCreds
83
+
84
+ $vagrantSecurePassword = ConvertTo-SecureString $vagrantUserPassword -AsPlainText -Force
85
+ $vagrantCreds = New-Object System.Management.Automation.PSCredential(
86
+ $vagrantUserName,
87
+ $vagrantSecurePassword
88
+ )
89
+
90
+ Configuration Configure_DomainUsers {
91
+
92
+ Import-DscResource -ModuleName xActiveDirectory
93
+ Import-DscResource -ModuleName xNetworking
94
+
95
+ Node localhost
96
+ {
97
+ LocalConfigurationManager
98
+ {
99
+ ConfigurationMode = 'ApplyOnly'
100
+ RebootNodeIfNeeded = $false
101
+ RefreshMode = "Push"
102
+ }
103
+
104
+ xADUser DomainAdmin
105
+ {
106
+ DomainName = $Node.DomainName
107
+ DomainAdministratorCredential = $vagrantCreds
108
+ UserName = $domainUserName
109
+ Password = $domainAdminCreds
110
+ Ensure = "Present"
111
+ }
112
+ }
113
+ }
114
+
115
+ $config = @{
116
+ AllNodes = @(
117
+ @{
118
+ NodeName = 'localhost'
119
+ PSDscAllowPlainTextPassword = $true
120
+ PSDscAllowDomainUser = $true
121
+ RetryCount = 10
122
+ RetryIntervalSec = 30
123
+
124
+ DomainName = $domainName.Split('.')[0]
125
+ }
126
+ )
127
+ }
128
+
129
+ $configuration = Get-Command Configure_DomainUsers
130
+ Start-UpliftDSCConfiguration $configuration $config
131
+
132
+ # ensuring group memebership
133
+ Write-UpliftMessage "Ensuring group memberships..."
134
+ try {
135
+ Write-UpliftMessage "[1/2] Ensuring group memberships..."
136
+
137
+ Add-ADGroupMember 'Domain Admins' 'vagrant',' admin'
138
+ } catch {
139
+ Write-UpliftMessage "[2/2] Ensuring group memberships..."
140
+
141
+ # try twice to ensure the following random issue
142
+ # Attempting to perform the InitializeDefaultDrives operation on the 'ActiveDirectory' provider failed
143
+
144
+ Add-ADGroupMember 'Domain Admins' 'vagrant',' admin'
145
+ }
146
+
147
+ exit 0