-
-
Save johnypony3/8886cbfa8c62056cc1e53bf47c0eebc7 to your computer and use it in GitHub Desktop.
Windows 2012/2016 template
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
{ | |
"builders": [{ | |
"boot_wait": "{{ user `boot_wait` }}", | |
"communicator": "winrm", | |
"cores": "{{ user `cores` }}", | |
"cpus": "{{ user `cpus` }}", | |
"disk_size": "{{user `disk_size` }}", | |
"disk_type_id": 0, | |
"display_name": "{{ user `long_name` }}", | |
"guest_os_type": "{{ user `guest_os_type` }}", | |
"floppy_files": [ | |
"{{ user `http_directory` }}/Autounattend.xml", | |
"{{ user `scripts_path` }}/*", | |
"packer/{{ user `env_os_type` }}/drivers/" | |
], | |
"headless": "{{ user `headless` }}", | |
"insecure_connection": "true", | |
"iso_checksum": "{{ user `iso_checksum_type` }}:{{ user `iso_checksum` }}", | |
"iso_url": "{{ user `iso_url` }}", | |
"memory": "{{ user `memory` }}", | |
"name": "vmware-iso", | |
"output_directory": "{{ user `output_directory` }}/vmware", | |
"shutdown_command": "{{ user `shutdown_command` }}", | |
"shutdown_timeout": "15m", | |
"ssh_username": "dummy", | |
"type": "vmware-iso", | |
"version": "{{ user `vm_version` }}", | |
"vm_name": "{{ user `long_name` }}", | |
"winrm_password": "{{user `winrm_password`}}", | |
"winrm_timeout": "1h", | |
"winrm_username": "{{user `winrm_username`}}", | |
"vnc_bind_address": "0.0.0.0", | |
"vmx_data": { | |
"scsi0.virtualDev": "pvscsi", | |
"vcpu.hotadd": "TRUE", | |
"cpu.hotadd": "TRUE", | |
"mem.hotadd": "TRUE" | |
}, | |
"vmx_data_post": { | |
"scsi0.virtualDev": "pvscsi", | |
"vcpu.hotadd": "TRUE", | |
"cpu.hotadd": "TRUE", | |
"mem.hotadd": "TRUE" | |
}, | |
"vmx_remove_ethernet_interfaces": true | |
}], | |
"provisioners": [{ | |
"type": "powershell", | |
"inline": [ | |
"[securestring]$secStringPassword = ConvertTo-SecureString {{ user `env_artifactory_key` }} -AsPlainText -Force", | |
"[pscredential]$cred = New-Object System.Management.Automation.PSCredential ('{{ user `env_artifactory_user` }}', $secStringPassword)", | |
"$source = 'https://artifactory.[MASKED].com/artifactory/{{ user `chef_package` }}'", | |
"$destination = 'C:\\Windows\\Temp\\chef-client.msi'", | |
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12", | |
"Invoke-WebRequest -Uri $source -OutFile $destination -Credential $cred", | |
"Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"/qn /i C:\\windows\\temp\\chef-client.msi \" -Passthru -Wait -NoNewWindow" | |
], | |
"elevated_user": "vagrant", | |
"elevated_password": "vagrant" | |
}, { | |
"type": "windows-update", | |
"search_criteria": "AutoSelectOnWebSites=1 and IsInstalled=0", | |
"filters": [ | |
"exclude:$_.Title -like '*Preview*'", | |
"include:$true" | |
] | |
}, { | |
"type": "windows-restart" | |
}, { | |
"config_template": "common/chef-solo-config.rb", | |
"cookbook_paths": [ | |
"{{ user `cookbook_path` }}" | |
], | |
"json": { | |
"gem_source": "{{ user `rubygems_url` }}" | |
}, | |
"guest_os_type": "{{ user `env_os_type` }}", | |
"run_list": [ | |
"{{ user `chef_run_list` }}" | |
], | |
"skip_install": "{{ user `skip_chef_install` }}", | |
"chef_license": "accept", | |
"type": "chef-solo", | |
"version": "{{ user `chef_install_version` }}", | |
"timeout": "5h" | |
}, { | |
"type": "windows-restart" | |
}, { | |
"type": "powershell", | |
"elevated_user": "vagrant", | |
"elevated_password": "vagrant", | |
"scripts": [ | |
"{{ user `scripts_path` }}/Remove-UpdateCache.ps1", | |
"{{ user `scripts_path` }}/Invoke-Defrag.ps1", | |
"{{ user `scripts_path` }}/Reset-EmptySpace.ps1", | |
"{{ user `scripts_path` }}/sysprep.ps1" | |
] | |
}, { | |
"type": "windows-restart" | |
}], | |
"post-processors": [{ | |
"type": "manifest", | |
"output": "{{ user `output_directory` }}/{{ user `long_name` }}.json", | |
"strip_path": true | |
}, { | |
"output": "{{ user `output_directory` }}/{{ user `long_name` }}.{{.Provider}}.box", | |
"include": [ | |
"{{ user `output_directory` }}/{{ user `long_name` }}.json" | |
], | |
"type": "vagrant" | |
}, | |
[{ | |
"cluster": "{{ user `vsphere_cluster` }}", | |
"datacenter": "{{ user `vsphere_datacenter` }}", | |
"datastore": "{{ user `vsphere_datastore` }}", | |
"disk_mode": "{{ user `vsphere_disk_mode` }}", | |
"host": "{{ user `vsphere_host` }}", | |
"insecure": "{{ user `vsphere_insecure` }}", | |
"password": "{{ user `vsphere_password` }}", | |
"resource_pool": "{{ user `vsphere_resource_pool` }}", | |
"type": "vsphere", | |
"username": "{{ user `vsphere_username` }}", | |
"vm_folder": "{{ user `vsphere_folder` }}", | |
"vm_name": "{{ user `vsphere_prepend` }}-{{ user `long_name` }}-{{ user `env_pipeline_id` }}" | |
}, { | |
"datacenter": "{{ user `vsphere_datacenter` }}", | |
"folder": "{{ user `vsphere_folder` }}", | |
"host": "{{ user `vsphere_host` }}", | |
"insecure": "{{ user `vsphere_insecure` }}", | |
"password": "{{ user `vsphere_password` }}", | |
"reregister_vm": false, | |
"type": "vsphere-template", | |
"username": "{{ user `vsphere_username` }}" | |
}] | |
], | |
"sensitive-variables": [ | |
"env_artifactory_key", | |
"vsphere_password" | |
], | |
"variables": { | |
"env_artifactory_key": "{{ env `ARTIFACTORY_API_KEY` }}", | |
"env_artifactory_user": "{{ env `ARTIFACTORY_READONLY_USER` }}", | |
"env_branch_name": "{{ env `CI_COMMIT_REF_NAME` }}", | |
"datetag": "{{env `datetag`}}", | |
"env_inspec_profile": "{{ env `INSPEC_PROFILE` }}", | |
"env_inspec_profiles_path": "{{ env `INSPEC_PROFILES_PATH` }}", | |
"env_inspec_sa_token": "{{ env `INSPEC_SA_TOKEN` }}", | |
"env_inspec_sa_username": "{{ env `INSPEC_SA_USERNAME` }}", | |
"env_os_version": "{{ env `OS_VERSION` }}", | |
"env_os": "{{ env `OS` }}", | |
"env_os_type": "{{ env `OS_TYPE` }}", | |
"env_output_dir": "{{ env `OUTPUT_DIR` }}", | |
"env_pipeline_id": "{{ env `CI_PIPELINE_ID` }}", | |
"env_vsphere_sa_password": "{{ env `VSPHERE_SA_PASSWORD` }}", | |
"env_vsphere_sa_username": "{{ env `VSPHERE_SA_USERNAME` }}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment