Use variables for scripts dirs

This commit is contained in:
jbarnett-r7 2017-08-21 11:42:46 -05:00 committed by GitHub
parent 0349491500
commit c1da9a028f
1 changed files with 95 additions and 26 deletions

View File

@ -1,36 +1,84 @@
{
"builders": [
{
"type": "vmware-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"boot_wait": "10m",
"communicator": "ssh",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "winServer2008Standard-64",
"tools_upload_flavor": "windows",
"disk_size": 61440,
"floppy_files": [
"{{user `autounattend`}}",
"{{user `scripts_dir`}}/configs/microsoft-updates.bat",
"{{user `scripts_dir`}}/configs/win-updates.ps1",
"{{user `scripts_dir`}}/installs/openssh.ps1",
"{{user `scripts_dir`}}/installs/install_dotnet45.ps1",
"{{user `scripts_dir`}}/installs/install_wmf.ps1",
"{{user `resources_dir`}}/certs/oracle-cert.cer",
"{{user `resources_dir`}}/certs/gdig2.crt",
"{{user `resources_dir`}}/certs/comodorsadomainvalidationsecureserverca.crt",
"{{user `resources_dir`}}/certs/comodorsacertificationauthority.crt",
"{{user `resources_dir`}}/certs/addtrust_external_ca.cer",
"{{user `resources_dir`}}/certs/baltimore_ca.cer",
"{{user `resources_dir`}}/certs/digicert.cer",
"{{user `resources_dir`}}/certs/equifax.cer",
"{{user `resources_dir`}}/certs/globalsign.cer",
"{{user `resources_dir`}}/certs/gte_cybertrust.cer",
"{{user `resources_dir`}}/certs/microsoft_root_2011.cer",
"{{user `resources_dir`}}/certs/thawte_primary_root.cer",
"{{user `resources_dir`}}/certs/utn-userfirst.cer"
],
"vm_name": "metasploitable3-win2k8",
"vmx_data": {
"cpuid.coresPerSocket": "2",
"memsize": "4096",
"numvcpus": "2",
"scsi0.virtualDev": "lsisas1068"
}
},
{
"type": "virtualbox-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": true,
"boot_wait": "2m",
"headless": false,
"boot_wait": "10m",
"communicator": "ssh",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "2h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows2008_64",
"disk_size": 61440,
"vm_name": "metasploitable3-win2k8",
"floppy_files": [
"{{user `autounattend`}}",
"./scripts/configs/microsoft-updates.bat",
"./scripts/configs/win-updates.ps1",
"./scripts/installs/openssh.ps1",
"./resources/certs/oracle-cert.cer",
"./resources/certs/gdig2.crt",
"./resources/certs/comodorsadomainvalidationsecureserverca.crt",
"./resources/certs/comodorsacertificationauthority.crt",
"./resources/certs/addtrust_external_ca.cer",
"./resources/certs/baltimore_ca.cer",
"./resources/certs/digicert.cer",
"./resources/certs/equifax.cer",
"./resources/certs/globalsign.cer",
"./resources/certs/gte_cybertrust.cer",
"./resources/certs/microsoft_root_2011.cer",
"./resources/certs/thawte_primary_root.cer",
"./resources/certs/utn-userfirst.cer"
"{{user `scripts_dir`}}/configs/microsoft-updates.bat",
"{{user `scripts_dir`}}/configs/win-updates.ps1",
"{{user `scripts_dir`}}/installs/openssh.ps1",
"{{user `scripts_dir`}}/installs/install_dotnet45.ps1",
"{{user `scripts_dir`}}/installs/install_wmf.ps1",
"{{user `resources_dir`}}/certs/oracle-cert.cer",
"{{user `resources_dir`}}/certs/gdig2.crt",
"{{user `resources_dir`}}/certs/comodorsadomainvalidationsecureserverca.crt",
"{{user `resources_dir`}}/certs/comodorsacertificationauthority.crt",
"{{user `resources_dir`}}/certs/addtrust_external_ca.cer",
"{{user `resources_dir`}}/certs/baltimore_ca.cer",
"{{user `resources_dir`}}/certs/digicert.cer",
"{{user `resources_dir`}}/certs/equifax.cer",
"{{user `resources_dir`}}/certs/globalsign.cer",
"{{user `resources_dir`}}/certs/gte_cybertrust.cer",
"{{user `resources_dir`}}/certs/microsoft_root_2011.cer",
"{{user `resources_dir`}}/certs/thawte_primary_root.cer",
"{{user `resources_dir`}}/certs/utn-userfirst.cer"
],
"vboxmanage": [
[
@ -49,16 +97,34 @@
}
],
"provisioners": [
{
"type": "file",
"source": "{{user `scripts_dir`}}",
"destination": "C:/vagrant"
},
{
"type": "file",
"source": "{{user `resources_dir`}}",
"destination": "C:/vagrant"
},
{
"type": "shell",
"remote_path": "/tmp/script.bat",
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
"scripts": [
"./scripts/installs/vm-guest-tools.bat",
"./scripts/configs/vagrant-ssh.bat",
"./scripts/configs/disable-auto-logon.bat",
"./scripts/configs/enable-rdp.bat",
"./scripts/configs/update_root_certs.bat"
"{{user `scripts_dir`}}/configs/update_root_certs.bat",
"{{user `scripts_dir`}}/installs/vm-guest-tools.bat",
"{{user `scripts_dir`}}/configs/vagrant-ssh.bat",
"{{user `scripts_dir`}}/configs/disable-auto-logon.bat",
"{{user `scripts_dir`}}/configs/enable-rdp.bat"
]
},
{
"type": "windows-shell",
"remote_path": "C:/Windows/Temp/script.bat",
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
"scripts": [
"{{user `scripts_dir`}}/configs/disable_firewall.bat"
]
}
],
@ -66,14 +132,17 @@
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "windows_2008_r2_{{.Provider}}_pro.box",
"vagrantfile_template": "vagrantfile-windows_2008_r2.template"
"output": "{{template_dir}}/../builds/windows_2008_r2_{{.Provider}}_{{user `box_version`}}_pro.box",
"vagrantfile_template": "{{template_dir}}/vagrantfile-windows_2008_r2.template"
}
],
"variables": {
"iso_url": "http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso",
"iso_checksum_type": "md5",
"iso_checksum": "4263be2cf3c59177c45085c0a7bc6ca5",
"autounattend": "./answer_files/2008_r2/Autounattend.xml"
"autounattend": "{{template_dir}}/../../answer_files/2008_r2/Autounattend.xml",
"scripts_dir": "{{template_dir}}/../../../scripts",
"resources_dir": "{{template_dir}}/../../..resources",
"box_version": "0.1.0"
}
}