packer.io wont work with DO

April 28, 2016 610 views
System Tools Server Optimization Ubuntu

Hello,
I have been following the instructions for Packer.io here:

https://www.digitalocean.com/community/tutorials/how-to-install-and-get-started-with-packer-on-an-ubuntu-12-04-vps

I have not deviated from the directions that I know of. All of the example packer.io templates I have found have failed validation.

root@packer:~/packer# packer validate foo.json
Failed to parse template: Error parsing JSON: invalid character '"' after object key:value pair
At line 6, column 6 (offset 158):
    5:     "region": "NYC3"
    6:     "
           ^

Here is the code I used right from the sample (excluding my API key)

{
  "builders": [{
    "type": "digitalocean",
    "api_token": "YOUR API TOKEN",
    "region": "nyc3"
    "size": "512mb"
    "image": "ubuntu-14-04-x64"
  }],

  "provisioners": [{
    "type": "shell",
    "inline": [
      "sleep 30",
      "sudo apt-get update",
      "sudo apt-get install -y apache2"
    ]
  }]

}

Anyone have a working packer.io template I can try? Or know why I can not get past packer validation?

Regards,
James

1 Answer

Figured out my own answer. Added commas....

{
  "builders": [{
    "type": "digitalocean",
    "api_token": "dda94b82f63c0dc3fdfd81243bd61c3e5de125a054971926e02e34342ee7eead",
    "region": "NYC3",
    "size": "512mb",
    "image": "ubuntu-14-04-x64"
  }],

  "provisioners": [{
    "type": "shell",
    "inline": [
      "sleep 30",
      "sudo apt-get update",
      "sudo apt-get install -y apache2"
    ]
  }]

}

~                 
Have another answer? Share your knowledge.