Last active
November 5, 2016 23:44
-
-
Save grafjo/e7e64433764a404113f8 to your computer and use it in GitHub Desktop.
Packer.io DigitalOcean example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"do_api_key": "", | |
"do_client_id": "", | |
"do_droplet_name": "trusty-x86-64-{{timestamp}}", | |
"do_private_networking": "false", | |
"do_image": "ubuntu-14-04-x64", | |
"do_region": "ams2", | |
"do_size": "512MB" | |
}, | |
"builders":[{ | |
"type": "digitalocean", | |
"api_key": "{{user `do_api_key`}}", | |
"client_id": "{{user `do_client_id`}}", | |
"droplet_name": "{{user `do_droplet_name`}}", | |
"private_networking": "{{user `do_private_networking`}}", | |
"image": "{{user `do_image`}}", | |
"region": "{{user `do_region`}}", | |
"size": "{{user `do_size`}}" | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packer build -var 'do_client_id=CLIENT_ID' -var 'do_api_key=API_KEY' digitalocean.json | |
digitalocean output will be in this color. | |
==> digitalocean: Creating temporary ssh key for droplet... | |
==> digitalocean: Creating droplet... | |
==> digitalocean: Error creating droplet: Invalid size or lookup failure: '{{user `do_size`}}': Unknown size '{{user `do_size`}}' | |
==> digitalocean: Deleting temporary ssh key... | |
Build 'digitalocean' errored: Error creating droplet: Invalid size or lookup failure: '{{user `do_size`}}': Unknown size '{{user `do_size`}}' | |
==> Some builds didn't complete successfully and had errors: | |
--> digitalocean: Error creating droplet: Invalid size or lookup failure: '{{user `do_size`}}': Unknown size '{{user `do_size`}}' | |
==> Builds finished but no artifacts were created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packer inspect digitalocean.json | |
Optional variables and their defaults: | |
do_api_key = | |
do_client_id = | |
do_droplet_name = trusty-x86-64-{{timestamp}} | |
do_image = ubuntu-14-04-x64 | |
do_private_networking = false | |
do_region = ams2 | |
do_size = 512MB | |
Builders: | |
digitalocean | |
Provisioners: | |
<No provisioners> | |
Note: If your build names contain user variables or template | |
functions such as 'timestamp', these are processed at build time, | |
and therefore only show in their raw form here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packer validate -var 'do_client_id=CLIENT_ID' -var 'do_api_key=API_KEY' digitalocean.json | |
Template validated successfully. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment