Question

Trouble provisioning new server using cloud-config/cloud-init/metadata

  • Posted November 14, 2014

Hi there,

I seem to be unable to create a server with the proper configuration via CloudInit. As instructed here (https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup) and here (https://www.digitalocean.com/community/tutorials/an-introduction-to-cloud-config-scripting), I created a YAML file that I pass in to the API when creating a droplet under the key “user_data”. It is a utf-8 encoded string.

I am attempting to create a 512mb droplet, on nyc3, using image ‘ubuntu-14-04-x64’.

I trigger the droplet creation via POST. The API returns with normal expected values, no errors.

Unfortunately, when I log in to the newly created droplet, it doesn’t seem as though the script has run. I tried creating it through the panel, pasting the contents of the script into the “user_data” field. This doesn’t seem to work either.

/var/log/cloudinit.log and /var/log/cloudinit-output.log don’t give any indication that my script has run.

You can review my YAML file here, in case there’s a syntax error I’ve missed: http://pastebin.com/ZL14ihjH

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Fixed it myself. I was sending in syntactically incorrect YAML.

For reference: http://pastebin.com/ZL14ihjH

  • “users” is an array, there should be a dash before “name”, but not before “shell” and “sudo”
  • the “sudo” value may need to be wrapped in [’ and ']
  • the last “run_cmd” option is missing a comma between two of the arguments