digital_ocean: any real-world examples of this working for droplet creation?

I’m sure this is just me being obtuse, but I’ve never figured out how to make digital_ocean idempotent (it will keep creating new instances)

http://www.ansibleworks.com/docs/modules.html#digital-ocean

Can I register a variable that is used for future runs w/o manual intervention? Does anyone have a working example playbook using this module??

Also, the example in the docs fails (I can open an issue, after making sure I’m not doing anything dumb)

- digital_ocean: >
      state=present
      command=droplet
      name=my_new_droplet
      client_id=XXX
      api_key=XXX
      size_id=1
      region_id=2
      image_id=3
      wait_timeout=500
  register: my_droplet
- debug: msg="ID: {{ my_droplet.droplet.id }} IP: {{ my_droplet.droplet.ip_address }}"
ERROR: Syntax Error while loading YAML script, <top secret>
Note: The error may actually appear before this position: line 22, column 17

  
- debug: msg="ID: {{ my_droplet.droplet.id }} IP: {{ my_droplet.droplet.ip_address }}

The error is caused by the ": " (colon followed by a space) on the line, you need to put quotes around the entire msg= part. This is a known YAML interpreter issue. So it should be like this:

- debug: 'msg="ID: {{ [my_droplet.droplet.id](http://my_droplet.droplet.id/) }} IP: {{ my_droplet.droplet.ip_address }}"'