{ "builders": [ { "type": "azure-arm", "client_id": "", "client_secret": "", "tenant_id": "", "subscription_id": "", "custom_managed_image_name": "centos-azmi-custom-image-1", "custom_managed_image_resource_group_name": "my-resource-group", "os_type": "Linux", "ssh_username": "centos", "polling_duration_timeout": "45m", "managed_image_resource_group_name": "my-resource-group", "managed_image_name": "Centos7-custom-image-v2-{{timestamp}}", "managed_image_storage_account_type": "Standard_LRS", "azure_tags": { "dept": "Engineering", "task": "Image deployment" }, "location": "", "vm_size": "Standard_B1s" } ], "provisioners": [ { "type": "shell", "inline": [ "sudo yum install ansible lvm2 WALinuxAgent cloud-init -y", "sudo mkdir /usr/local/tmp", "sudo chown -R centos.centos /usr/local/tmp", "sudo chmod -R 777 /usr/local/tmp" ] }, { "type": "ansible-local", "staging_directory": "/usr/local/tmp", "playbook_file": "roles/azure-centos-standard-v2.yml", "playbook_dir": "roles" }, { "type": "shell", "remote_folder": "/usr/local/tmp", "script": "scripts/script.sh", "execute_command": "echo 'password'| sudo -S bash {{.Path}}", "expect_disconnect": "true", "pause_before": "30s", "timeout": "20s", "start_retry_timeout": "5m" }, { "type": "ansible-local", "staging_directory": "/usr/local/tmp", "playbook_file": "roles/azure-centos-standard-v3.yml", "playbook_dir": "roles" }, { "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", "inline": [ "/usr/sbin/waagent -force -deprovision && export HISTSIZE=0 && sync" ], "inline_shebang": "/bin/sh -x", "type": "shell" } ] }