Can somebody tell me what I am doing wrong here as I am unable to create the image? actually the commands, when I run on my host Centos machine, works fine but when I execute the same commands through packer result into error.
JSON file:
{
"builders": [{
"type": "azure-arm",
"client_id": "{{user `azure-client-id`}}",
"client_secret": "{{user `azure-client-secret`}}",
"tenant_id": "{{user `azure-tenant-id`}}",
"subscription_id": "{{user `azure-subscription-id`}}",
"managed_image_resource_group_name": "{{user `azure-resource-group`}}",
"managed_image_name": "CentOS8-Packer",
"os_type": "Linux",
"image_publisher": "OpenLogic",
"image_offer": "CentOS",
"image_sku": "8_2-gen2",
"location": "{{user `azure-region`}}",
"vm_size": "{{user `vm-size`}}"
}],
"provisioners": [
{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"script":"ami-script.sh"
"type": "shell"
}
]
}
ami-script.sh content:
#!/bin/bash -e
dnf update -y
dnf install terminator xrdp -y
Error: