Last active
August 7, 2019 05:22
-
-
Save marcosmamg/add9636aed2a9c3a644f82b5a32394b3 to your computer and use it in GitHub Desktop.
packer template.json cis-windows-server-2016
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
{ | |
"variables": | |
{ | |
"gcp_project": "myproject" | |
}, | |
"builders": | |
[ | |
{ | |
"type": "googlecompute", | |
"project_id": "{{ user `gcp_project` }}", | |
"source_image_project_id": "cis-public", | |
"source_image": "cis-windows-server-2016-v1-1-0-2-level-1", | |
"image_family": "my-windows-server-2016", | |
"disk_size": "50", | |
"image_name": "my-windows-server-2016-{{timestamp}}", | |
"zone": "us-central1-a", | |
"service_account_email": "packer@myproject.iam.gserviceaccount.com", | |
"subnetwork": "mysubnetwork", | |
"tags": ["winrm"], | |
"state_timeout": "30m", | |
"communicator": "winrm", | |
"winrm_username": "packer", | |
"winrm_use_ssl": true, | |
"winrm_use_ntlm": true, | |
"winrm_insecure": true, | |
"pause_before_connecting": "10m", | |
"metadata": { | |
"sysprep-specialize-script-ps1": "../winrmconfig.ps1" | |
} | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "powershell", | |
"inline": | |
[ | |
"Invoke-RestMethod -Headers @{'Metadata-Flavor'='Google'} -Uri 'http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip' | Out-File -Append -Encoding utf8 C:/Windows/Temp/ip-address" | |
] | |
}, | |
{ | |
"type": "file", | |
"direction": "download", | |
"source": "C:/Windows/Temp/ip-address", | |
"destination": "../../ansible/playbooks/eft-express/ip-address" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment