Skip to content

Instantly share code, notes, and snippets.

@nabarunchatterjee
Created March 5, 2018 12:56
Show Gist options
  • Save nabarunchatterjee/039ec21ba1e81588cc773bb242d4f0e5 to your computer and use it in GitHub Desktop.
Save nabarunchatterjee/039ec21ba1e81588cc773bb242d4f0e5 to your computer and use it in GitHub Desktop.
packer output
{
"builds": [
{
"name": "azure",
"builder_type": "azure-arm",
"build_time": 1520253044,
"files": null,
"artifact_id": "",
"packer_run_uuid": "133256b9-b92a-9ee5-0664-c04f031c865b"
}
],
"last_run_uuid": "133256b9-b92a-9ee5-0664-c04f031c865b"
}
{
"image_name": "test-image",
"source_ami_id": "ubuntu16.04-chefc-12v5-rmdpkglock",
"provisioner_script": "test.sh"
}
{
"variables": {
"image_name": "",
"provisioner_script": "",
"source_ami_id": "",
"azure_client_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"azure_client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"azure_subscription_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"azure_tenant_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"azure_managed_image_resource_group_name": "stage-rg",
"azure_custom_managed_image_name": "ubuntu16.04-chefc-12v5-rmdpkglock",
"azure_custom_managed_image_resource_group_name": "stage-rg",
"azure_virtual_network_name": "stage-vnet",
"azure_virtual_network_resource_group_name": "stage-rg",
"azure_virtual_network_subnet_name": "stage-prv-apps-001",
"azure_location": "South India",
"azure_vm_size": "Standard_D2s_v3"
},
"builders": [
{
"type": "azure-arm",
"name": "azure",
"client_id": "{{user `azure_client_id`}}",
"client_secret": "{{user `azure_client_secret`}}",
"subscription_id": "{{user `azure_subscription_id`}}",
"tenant_id": "{{user `azure_tenant_id`}}",
"managed_image_name": "{{user `image_name`}}",
"managed_image_resource_group_name": "{{user `azure_managed_image_resource_group_name`}}",
"custom_managed_image_name": "{{user `source_ami_id`}}",
"custom_managed_image_resource_group_name": "{{user `azure_custom_managed_image_resource_group_name`}}",
"os_type": "Linux",
"virtual_network_name": "{{user `azure_virtual_network_name`}}",
"virtual_network_resource_group_name": "{{user `azure_virtual_network_resource_group_name`}}",
"virtual_network_subnet_name": "{{user `azure_virtual_network_subnet_name`}}",
"azure_tags": {
"build_time": "{{timestamp}}",
"Name": "{{user `image_name`}}"
},
"location": "{{user `azure_location`}}",
"vm_size": "{{user `azure_vm_size`}}"
}
],
"provisioners": [
{
"type": "shell",
"script": "{{user `provisioner_script`}}"
}
],
"post-processors": [
{
"type": "manifest",
"output": "manifest.json",
"strip_path": true
}
]
}
nabarunchatterjee@mib1:~$ packer build -var-file=packer-vars.json packer.json
azure output will be in this color.
==> azure: Running builder ...
azure: Creating Azure Resource Manager (ARM) client ...
==> azure: Creating resource group ...
==> azure: -> ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure: -> Location : 'South India'
==> azure: -> Tags :
==> azure: ->> Name : test-image
==> azure: ->> build_time : 1520252451
==> azure: Validating deployment template ...
==> azure: -> ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure: -> DeploymentName : 'pkrdpzn56rrkd14'
==> azure: Deploying deployment template ...
==> azure: -> ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure: -> DeploymentName : 'pkrdpzn56rrkd14'
==> azure: Getting the VM's IP address ...
==> azure: -> ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure: -> PublicIPAddressName : 'packerPublicIP'
==> azure: -> NicName : 'packerNic'
==> azure: -> Network Connection : 'PrivateEndpoint'
==> azure: -> IP Address : '10.205.0.104'
==> azure: Waiting for SSH to become available...
==> azure: Connected to SSH!
==> azure: Provisioning with shell script: test.sh
azure: hello world
==> azure: Querying the machine's properties ...
==> azure: -> ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure: -> ComputeName : 'pkrvmzn56rrkd14'
==> azure: -> Managed OS Disk : '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/packer-Resource-Group-zn56rrkd14/providers/Microsoft.Compute/disks/osdisk'
==> azure: Powering off machine ...
==> azure: -> ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure: -> ComputeName : 'pkrvmzn56rrkd14'
==> azure: Capturing image ...
==> azure: -> Compute ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure: -> Compute Name : 'pkrvmzn56rrkd14'
==> azure: -> Compute Location : 'South India'
==> azure: -> Image ResourceGroupName : 'stage-rg'
==> azure: -> Image Name : 'test-image'
==> azure: -> Image Location : 'southindia'
==> azure: Deleting resource group ...
==> azure: -> ResourceGroupName : 'packer-Resource-Group-zn56rrkd14'
==> azure:
==> azure: The resource group was created by Packer, deleting ...
==> azure: Deleting the temporary OS disk ...
==> azure: -> OS Disk : skipping, managed disk was used...
==> azure: Running post-processor: manifest
Build 'azure' finished.
==> Builds finished. The artifacts of successful builds are:
--> azure: Azure.ResourceManagement.VMImage:
ManagedImageResourceGroupName: stage-rg
ManagedImageName: test-image
ManagedImageLocation: southindia
--> azure:
echo "hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment