Skip to content

Instantly share code, notes, and snippets.

@J00MZ
Created March 12, 2019 17:08
Show Gist options
  • Save J00MZ/5cd719f1416aeb623de841d22d3a101c to your computer and use it in GitHub Desktop.
Save J00MZ/5cd719f1416aeb623de841d22d3a101c to your computer and use it in GitHub Desktop.
packer.json crash
{
"variables": {
"azure_client_secret": "{{env `AZURE_CLIENT_SECRET`}}",
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"datadog_api_key": "{{env `DATADOG_API_KEY`}}"
},
"builders": [
{
"type": "amazon-ebs",
"ami_name": "nodejs {{timestamp}}",
"ami_description": "Ubuntu 16.04, nginx 1.10.3, Node.js 8.x LTS",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{user `aws_region`}}",
"source_ami": "ami-08660f1c6fb6b01e7",
"instance_type": "m3.medium",
"ssh_username": "ubuntu",
"launch_block_device_mappings": [{
"delete_on_termination": true,
"device_name": "/dev/xvdf",
"encrypted": false,
"volume_size": 50,
"volume_type": "gp2"
}]
},
{
"type": "azure-arm",
"client_id": "{{ user `client_id`}}",
"client_secret": "{{user `azure_client_secret`}}",
"managed_image_name": "node-{{timestamp}}",
"managed_image_resource_group_name": "{{ user `resource_group_name` }}",
"build_resource_group_name": "{{ user `resource_group_name` }}",
"subscription_id": "{{ user `subscription_id` }}",
"tenant_id": "{{ user `tenant_id` }}",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "16.04-LTS",
"vm_size": "Standard_A2_V2",
"os_disk_size_gb": "30",
"disk_additional_size": ["50"],
"azure_tags": {
"type": "node",
"createdBy": "packer"
}
}
],
"provisioners": [
{
"type": "shell",
"script": "setup/_common.sh",
"environment_vars": ["DATADOG_API_KEY={{ user `datadog_api_key` }}"]
},
{
"type": "shell",
"script": "setup/aws.sh",
"only": ["amazon-ebs"]
},
{
"type": "shell",
"script": "setup/azure.sh",
"only": ["azure-arm"]
},
{
"type": "shell",
"script": "post/_common.sh"
},
{
"type": "shell",
"script": "post/azure.sh",
"only": ["azure-arm"]
}
],
"post-processors": [
{
"type": "manifest",
"output": "manifest.json",
"strip_path": true
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment