I am working on to build GCP golden image. I am using HyperV-ISO builder to build the image.
Converting VHDX to Disk.raw using qumu.exe (Because GCP support disk.raw format) (Success)
Compressing disk.raw into tar.gz format (Ex.tar -cf filename.tar.gz F:\disk.raw) (Success)
I need your valuable solution here.
{
"variables": {
"disk_size_rhel_8": "30720",
"iso_url_rhel_8_0": "F:\\ISOs\\rhel-8.4-x86_64-dvd.iso",
"iso_checksum_rhel_8_0": "48f955712454c32718dcde858dea5aca574376a1d7a4b0ed6908ac0b85597811",
"iso_checksum_type": "sha256",
"output_directory": "F:\\gcp_image_build\\Imagesnew\\"
},
"provisioners": [
{
"type": "shell",
"execute_command": "bash '{{.Path}}'",
"script": "scripts/rhel_prep.sh"
},
{
"type": "shell",
"execute_command": "bash '{{.Path}}'",
"script": "scripts/install_ansible.sh"
},
{
"type": "shell",
"execute_command": "bash '{{.Path}}'",
"script": "scripts/redhat_cleanup.sh"
}
],
"builders": [
{
"type": "hyperv-iso",
"boot_command": [
"<esc><wait>",
"linux ks=http://{{ .HTTPIP }}:{{ .HTTPPort}}/ks_rhel_8_4.cfg<enter><wait>"
],
"boot_wait": "10s",
"cpus": 1,
"disk_size": "{{ user `disk_size_rhel_8` }}",
"enable_dynamic_memory": false,
"enable_mac_spoofing": true,
"generation": 1,
"http_directory": "F:\\gcp_image_build\\rhel_iso\\http",
"http_port_min": 8000,
"http_port_max": 9000,
"iso_url": "{{ user `iso_url_rhel_8_0` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"iso_checksum": "{{ user `iso_checksum_rhel_8_0` }}",
"output_directory": "{{ user `output_directory` }}",
"memory": 2048,
"skip_export": true,
"ssh_username": "root",
"ssh_password": "l!nux",
"ssh_port": 22,
"ssh_timeout": "4h",
"shutdown_command": "echo '{{ user `ssh_username` }}'|sudo -S /sbin/halt -h -p",
"switch_name": "ImageBuild",
"vm_name": "disk.raw"
}
],
"post-processors": [
{
"type": "shell-local",
"execute_command": ["cmd.exe","/C","{{.Command}}"],
"inline": ["scripts/copy.bat"]
},
{
"type": "shell-local",
"inline": [
"gcloud auth activate-service-account --key-file *** --project=***",
"gsutil -m cp 'F:\\gcp_image_build\\rhel_iso\\diskraw\\rhel8.raw.tar.gz' gs://***/",
"gcloud compute images create rhelimg8 --source-uri gs://***/rhel8.raw.tar.gz --project=***"
]
},
{
"output": "manifest.json",
"strip_path": true,
"type": "manifest"
}
]
}