Dear Team,
I’m trying to create a CentOS 8 image in google compute cloud via packer by provisioning all my tasks through ansible roles.
Actually, internet to external world from a GCE instance is restricted and it is allowed through a proxy channel. So, I tried to update my /etc/yum.conf file using shell provisioner. But it was throwing error that it is unable to write a file under /etc.
So, I created a yum.conf file with proxy entry included in it and inserted it to the target VM via startup_script_file from builder section itself. The file got replaced during the VM boot up and I’m able to reach internet during the provisioning phase (for package installation).
my packer.json file:
{
“builders”: [
{
“type”: “googlecompute”,
“account_file”: “service-key.json”,
“project_id”: “xxxxxxx”,
“source_image”: “{{user ami_id
}}”,
“source_image_family”: “centos-8”,
“network”: “yyyyyyyy”,
“subnetwork”: “zzzzzzzzzzzzzzz”,
“network_project_id”: “wwwwwwwwww”,
“omit_external_ip”: “true”,
“use_internal_ip”: “true”,
“disk_size”: “30”,
“image_name”: “centos8-std-gcp-temp-image-{{timestamp}}”,
“ssh_username”: “centos”,
“zone”: “xxxxxxxxxx”,
“startup_script_file”: “scripts/config_proxy.sh”,
“metadata”: {
“startup-script-log-dest”: “/opt/script.log”,
“wrap_startup_script”: “true”,
“startup-script-status”: “done”
}
}
]
But at the end of my provisioning phase, it is throwing the below messages and ended up after waiting for a long time.
Error:
Could some one please help me to correct my script if I’m missing here.
Regards,
Guru Mohan G