Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Bob Tanner
packer-windows
Commits
1fcdcec0
Commit
1fcdcec0
authored
Oct 09, 2013
by
dylanmei
Browse files
Changes to accomodate windows 2008 r2 wip
parent
1772b032
Changes
9
Hide whitespace changes
Inline
Side-by-side
answer_files/2008_r2/Autounattend.xml
View file @
1fcdcec0
...
...
@@ -115,115 +115,133 @@
<Order>
2
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c a:\install-cygwin-sshd.bat
</CommandLine>
<Description>
Install Cygwin SSH
</Description>
<Order>
3
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm quickconfig -q
</CommandLine>
<Description>
winrm quickconfig -q
</Description>
<Order>
4
</Order>
<Order>
3
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm quickconfig -transport:http
</CommandLine>
<Description>
winrm quickconfig -transport:http
</Description>
<Order>
5
</Order>
<Order>
4
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}
</CommandLine>
<Description>
Win RM MaxTimoutms
</Description>
<Order>
6
</Order>
<Order>
5
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
</CommandLine>
<Description>
Win RM MaxMemoryPerShellMB
</Description>
<Order>
7
</Order>
<Order>
6
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}
</CommandLine>
<Description>
Win RM AllowUnencrypted
</Description>
<Order>
8
</Order>
<Order>
7
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}
</CommandLine>
<Description>
Win RM auth Basic
</Description>
<Order>
9
</Order>
<Order>
8
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}
</CommandLine>
<Description>
Win RM client auth Basic
</Description>
<Order>
10
</Order>
<Order>
9
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}
</CommandLine>
<Description>
Win RM listener Address/Port
</Description>
<Order>
1
1
</Order>
<Order>
1
0
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
</CommandLine>
<Description>
Win RM adv firewall enable
</Description>
<Order>
1
2
</Order>
<Order>
1
1
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985"
</CommandLine>
<Description>
Win RM port open
</Description>
<Order>
1
3
</Order>
<Order>
1
2
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c net stop winrm
</CommandLine>
<Description>
Stop Win RM Service
</Description>
<Order>
1
4
</Order>
<Order>
1
3
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c sc config winrm start=
auto
</CommandLine>
<CommandLine>
cmd.exe /c sc config winrm start=auto
</CommandLine>
<Description>
Win RM Autostart
</Description>
<Order>
1
5
</Order>
<Order>
1
4
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c net start winrm
</CommandLine>
<Description>
Start Win RM Service
</Description>
<Order>
1
6
</Order>
<Order>
1
5
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\install-win-updates.ps1
</CommandLine>
<Description>
Install Windows Updates
</Description>
<Order>
17
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f
</CommandLine>
<Order>
16
</Order>
<Description>
Show file extensions in Explorer
</Description>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
</CommandLine>
<Order>
1
8
</Order>
<Order>
1
7
</Order>
<Description>
Enable QuickEdit mode
</Description>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v HideFileExt /t REG_DWORD /d 0 /f
</CommandLine>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f
</CommandLine>
<Order>
18
</Order>
<Description>
Show Run command in Start Menu
</Description>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f
</CommandLine>
<Order>
19
</Order>
<Description>
Show
file extensions in Explorer
</Description>
<Description>
Show
Administrative Tools in Start Menu
</Description>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HK
CU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun
/t REG_DWORD /d
1
/f
</CommandLine>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HK
LM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent
/t REG_DWORD /d
0
/f
</CommandLine>
<Order>
20
</Order>
<Description>
Show Run command in Start Menu
</Description>
<Description>
Zero Hibernation File
</Description>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HK
CU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools
/t REG_DWORD /d
1
/f
</CommandLine>
<CommandLine>
%SystemRoot%\System32\reg.exe ADD HK
LM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled
/t REG_DWORD /d
0
/f
</CommandLine>
<Order>
21
</Order>
<Description>
Show Administrative Tools in Start Menu
</Description>
<Description>
Disable Hibernation Mode
</Description>
</SynchronousCommand>
<!-- WITHOUT WINDOWS UPDATES
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\openssh-6.2.bat START</CommandLine>
<Description>Install OpenSSH</Description>
<Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand> -->
<!-- WITH WINDOWS UPDATES -->
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c a:\openssh-6.2.bat
</CommandLine>
<Description>
Install OpenSSH
</Description>
<Order>
99
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand
wcm:action=
"add"
>
<CommandLine>
cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\win-updates.ps1
</CommandLine>
<Description>
Install Windows Updates
</Description>
<Order>
100
</Order>
<RequiresUserInput>
true
</RequiresUserInput>
</SynchronousCommand>
</FirstLogonCommands>
<ShowWindowsLive>
false
</ShowWindowsLive>
...
...
scripts/chef.bat
View file @
1fcdcec0
if
not
exist
"C:\Windows\Temp\chef.msi"
(
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://www.opscode.com/chef/install.msi', 'C:\Windows\Temp\chef.msi')"
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://www.opscode.com/chef/install.msi', 'C:\Windows\Temp\chef.msi')"
<
NUL
)
msiexec
/qb /i
C
:\Windows\Temp\chef.msi
powershell
-Command
"Start-Sleep 1"
start
/wait
powershell
-Command
"Start-Sleep 1"
<
NUL
scripts/chocolatey.bat
View file @
1fcdcec0
set
TEMP
=
C
:\Windows\Temp
powershell
-NoProfile -ExecutionPolicy
unrestricted
-Command
"iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
powershell
-NoProfile -ExecutionPolicy
unrestricted
-Command
"iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
<
NUL
cmd
/c
setx
/m
PATH
"
%path%
;C:\\Chocolatey\bin"
scripts/puppet-enterprise.bat
View file @
1fcdcec0
if
not
exist
"C:\Windows\Temp\puppet.msi"
(
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://pm.puppetlabs.com/puppet-enterprise/3.0.1/puppet-enterprise-3.0.1.msi', 'C:\Windows\Temp\puppet.msi')"
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://pm.puppetlabs.com/puppet-enterprise/3.0.1/puppet-enterprise-3.0.1.msi', 'C:\Windows\Temp\puppet.msi')"
<
NUL
)
msiexec
/qn /i
C
:\Windows\Temp\puppet.msi
:: http://docs.puppetlabs.com/pe/latest/install_windows.html
msiexec
/qn /i
C
:\Windows\Temp\puppet.msi
/log
C
:\Windows\Temp\puppet.log
cmd
/c
setx
/m
PATH
"
%path%
;C:\\Program Files (x86)\\Puppet Labs\\Puppet Enterprise\\bin"
powershell
-Command
"Start-Sleep 1"
\ No newline at end of file
powershell
-Command
"Start-Sleep 1"
<
NUL
scripts/puppet.bat
View file @
1fcdcec0
if
not
exist
"C:\Windows\Temp\puppet.msi"
(
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://downloads.puppetlabs.com/windows/puppet-3.3.0.msi', 'C:\Windows\Temp\puppet.msi')"
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://downloads.puppetlabs.com/windows/puppet-3.3.0.msi', 'C:\Windows\Temp\puppet.msi')"
<
NUL
)
msiexec
/qn /i
C
:\Windows\Temp\puppet.msi
:: http://docs.puppetlabs.com/pe/latest/install_windows.html
msiexec
/qn /i
C
:\Windows\Temp\puppet.msi
/log
C
:\Windows\Temp\puppet.log
cmd
/c
setx
/m
PATH
"
%path%
;C:\\Program Files (x86)\\Puppet Labs\\Puppet\\bin"
powershell
-Command
"Start-Sleep 1"
powershell
-Command
"Start-Sleep 1"
<
NUL
scripts/vagrant-ssh.bat
View file @
1fcdcec0
...
...
@@ -4,5 +4,5 @@ mkdir "C:\Users\vagrant\.ssh"
if
exist
a
:\vagrant.pub
(
copy
a
:\vagrant.pub
C
:\Users\vagrant\.ssh\authorized_keys
)
else
(
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagrant\.ssh\authorized_keys')"
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagrant\.ssh\authorized_keys')"
<
NUL
)
scripts/vm-guest-tools.bat
View file @
1fcdcec0
if
not
exist
"C:\Windows\Temp\7z920-x64.msi"
(
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/sevenzip/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')"
<
NUL
)
msiexec
/qb /i
C
:\Windows\Temp\7z920
-x
64
.msi
if
"
%PACKER_BUILDER_TYPE%
"
eq
"vmware"
goto
:vmware
if
"
%PACKER_BUILDER_TYPE%
"
eq
"virtualbox"
goto
:virtualbox
goto
:
eof
if
"
%PACKER_BUILDER_TYPE%
"
eq
u
"vmware"
goto
:vmware
if
"
%PACKER_BUILDER_TYPE%
"
eq
u
"virtualbox"
goto
:virtualbox
goto
:
done
:vmware
if
not
exist
"C:\Windows\Temp\7z920-x64.msi"
(
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/sevenzip/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')"
)
cmd
/c
msiexec
/qb /i
C
:\Windows\Temp\7z920
-x
64
.msi
if
not
exist
"C:\Windows\Temp\VMWare\setup.exe"
(
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/10.0.0/1295980/windows/packages/tools-windows-9.6.0.exe.tar', 'C:\Windows\Temp\vmware-tools.exe.tar')"
powershell
-Command
"(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/10.0.0/1295980/windows/packages/tools-windows-9.6.0.exe.tar', 'C:\Windows\Temp\vmware-tools.exe.tar')"
<
NUL
cmd
/c
"C:\Program Files\7-Zip\7z.exe"
x
C
:\Windows\Temp\vmware
-tools
.exe.tar
-oC
:\Windows\Temp
cmd
/c
C
:\Windows\Temp\tools
-windows
-
9
.6.0
cmd
/c
""
C
:\Program
Files
\7
-Zip
\7z.exe
" x "
C
:\Program
Files
(
x86
)
\VMWare\tools
-windows
\windows.iso
" -oC:\Windows\Temp\VMWare"
...
...
@@ -19,13 +18,18 @@ if not exist "C:\Windows\Temp\VMWare\setup.exe" (
)
cmd
/c
C
:\Windows\Temp\VMWare\setup.exe
/S /v
"/qn REBOOT=R\"
cmd
/c
msiexec
/qb /x
C
:\Windows\Temp\7z920
-x
64
.msi
goto
:eof
goto
:done
:virtualbox
:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd
/c
certutil
-addstore -f
"TrustedPublisher"
A
:\oracle
-cert
.cer
cmd
/c
E
:\VBoxWindowsAdditions.exe
/S
goto
:eof
mv
C
:\Users\vagrant\VBoxGuestAdditions.iso
C
:\Windows\Temp
cmd
/c
"C:\Program Files\7-Zip\7z.exe"
x
C
:\Windows\Temp\VBoxGuestAdditions.iso
-oC
:\Windows\Temp\virtualbox
cmd
/c
C
:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe
/S
goto
:done
:done
msiexec
/qb /x
C
:\Windows\Temp\7z920
-x
64
.msi
windows_2008_r2.json
View file @
1fcdcec0
...
...
@@ -9,12 +9,16 @@
"ssh_username"
:
"vagrant"
,
"ssh_password"
:
"vagrant"
,
"ssh_wait_timeout"
:
"2h"
,
"shutdown_command"
:
"shutdown /s /t 10
/f /d p:4:1 /c
\"
Vagrant
Shutdown
\"
"
,
"shutdown_command"
:
"shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer
Shutdown
\"
"
,
"guest_os_type"
:
"windows7srv-64"
,
"disk_size"
:
61440
,
"vnc_port_min"
:
5900
,
"vnc_port_max"
:
5980
,
"floppy_files"
:
[
"./answer_files/2008_r2/Autounattend.xml"
,
"./scripts/install-cygwin-sshd.bat"
,
"./scripts/install-win-updates.ps1"
],
"floppy_files"
:
[
"./answer_files/2008_r2/Autounattend.xml"
,
"./scripts/win-updates.ps1"
,
"./scripts/openssh-6.2.bat"
],
"vmx_data"
:
{
"RemoteDisplay.vnc.enabled"
:
"false"
,
"RemoteDisplay.vnc.port"
:
"5900"
,
...
...
@@ -31,14 +35,14 @@
"ssh_username"
:
"vagrant"
,
"ssh_password"
:
"vagrant"
,
"ssh_wait_timeout"
:
"2h"
,
"shutdown_command"
:
"shutdown /s /t 10
/f /d p:4:1 /c
\"
Vagrant
Shutdown
\"
"
,
"shutdown_command"
:
"shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer
Shutdown
\"
"
,
"guest_os_type"
:
"Windows2008_64"
,
"disk_size"
:
61440
,
"floppy_files"
:
[
"./answer_files/2008_r2/Autounattend.xml"
,
"./scripts/
oracle-cert.cer
"
,
"./scripts/
install-cygwin-sshd
.bat"
,
"./scripts/
install-win-updates.ps1
"
"./scripts/
win-updates.ps1
"
,
"./scripts/
openssh-6.2
.bat"
,
"./scripts/
oracle-cert.cer
"
],
"vboxmanage"
:
[
[
"modifyvm"
,
"{{.Name}}"
,
"--memory"
,
"2048"
],
...
...
@@ -46,9 +50,17 @@
]
}],
"provisioners"
:
[{
"type"
:
"shell"
,
"scripts"
:
[
"./scripts/postinstall.sh"
,
"./scripts/install-vmware-tools.sh"
,
"./scripts/install-virtualbox-tools.sh"
,
"./scripts/install-chef.sh"
]
}],
"type"
:
"shell"
,
"remote_path"
:
"/tmp/script.bat"
,
"execute_command"
:
"{{.Vars}} cmd /c C:/Windows/Temp/script.bat"
,
"scripts"
:
[
"./scripts/vm-guest-tools.bat"
,
"./scripts/chef.bat"
,
"./scripts/vagrant-ssh.bat"
]
},
{
"type"
:
"shell"
,
"inline"
:
[
"rm -rf /tmp/*"
]
}],
"post-processors"
:
[{
"type"
:
"vagrant"
,
"keep_input_artifact"
:
false
,
...
...
windows_2012.json
View file @
1fcdcec0
...
...
@@ -10,7 +10,6 @@
"ssh_password"
:
"vagrant"
,
"ssh_wait_timeout"
:
"2h"
,
"shutdown_command"
:
"shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer Shutdown
\"
"
,
"shutdown_timeout"
:
"2h"
,
"guest_os_type"
:
"windows8srv-64"
,
"disk_size"
:
61440
,
"vnc_port_min"
:
5900
,
...
...
@@ -39,7 +38,6 @@
"shutdown_command"
:
"shutdown /s /t 10 /f /d p:4:1 /c
\"
Packer Shutdown
\"
"
,
"guest_os_type"
:
"Windows2012_64"
,
"disk_size"
:
61440
,
"guest_additions_attach"
:
"true"
,
"floppy_files"
:
[
"./answer_files/2012/Autounattend.xml"
,
"./scripts/win-updates.ps1"
,
...
...
@@ -52,24 +50,20 @@
]
}],
"provisioners"
:
[{
"type"
:
"file"
,
"source"
:
"./scripts/Windows8-RT-KB2842230-x64.msu"
,
"destination"
:
"/tmp/Windows8-RT-KB2842230-x64.msu"
},
{
"type"
:
"shell"
,
"remote_path"
:
"/tmp/script.bat"
,
"execute_command"
:
"{{.Vars}} cmd /c C:/Windows/Temp/script.bat"
,
"scripts"
:
[
"./scripts/hotfix-KB2842230.bat"
,
"./scripts/vm-guest-tools.bat"
,
"./scripts/puppet.bat"
,
"./scripts/chef.bat"
,
"./scripts/
chocolatey
.bat"
"./scripts/
vagrant-ssh
.bat"
]
},
{
"type"
:
"shell"
,
"inline"
:
[
"rm -rf /tmp/*"
]
}],
}],
"post-processors"
:
[{
"type"
:
"vagrant"
,
"
only"
:
[
"virtualbox"
,
"vmware"
]
,
"
keep_input_artifact"
:
false
,
"output"
:
"windows_2012_{{.Provider}}.box"
,
"vagrantfile_template"
:
"vagrantfile-windows_2012.template"
}]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment