I did downgrade the version of packer on ubuntu to 1.1.1 and got the same result.
Only difference between successful image baking and failure is running packer on Ubuntu 16.04 vs Mac OS High Sierra. Mac OS High Sierra running same version of packer/ansible/same packer config, same ansible playbook works. It fails on Ubuntu.
I can share the ansible playbook privately if I can get an email address.
{
"variables": {
"azureserviceprincipalusername": "",
"azureserviceprincipalpassword": "",
"azuretenantid": "",
"azuresubscriptionid": "",
"imageresourcegroup": "imagerg",
"imagename": "",
"location": "East US",
"imagestoragetype": "Standard_LRS",
"os_type": "",
"image_publisher": "",
"image_offer": "",
"image_sku": ""
},
"builders": [{
"type": "azure-arm",
"ssh_pty": true,
"client_id": "{{user `azureserviceprincipalusername`}}",
"client_secret": "{{user `azureserviceprincipalpassword`}}",
"tenant_id": "{{user `azuretenantid`}}",
"subscription_id": "{{user `azuresubscriptionid`}}",
"managed_image_resource_group_name": "{{user `imageresourcegroup`}}",
"managed_image_name": "{{user `imagename`}}",
"managed_image_storage_account_type": "{{user `imagestoragetype`}}",
"os_type": "{{user `os_type`}}",
"image_publisher": "{{user `image_publisher`}}",
"image_offer": "{{user `image_offer`}}",
"image_sku": "{{user `image_sku`}}",
"ssh_username": "packer",
"azure_tags": {
"task": "Image deployment",
"contact": "{{user `buildservercontact`}}"
},
"location": "{{user `location`}}",
"vm_size": "Standard_DS2_v2"
}],
"provisioners": [
{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"scripts": [ "scripts/installclamav.sh" ],
"type": "shell"
},
{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"scripts": [ "scripts/installdocker.sh" ],
"type": "shell"
},
{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"scripts": [ "scripts/installsplunk.sh" ],
"type": "shell"
},