ansible/ansible — pull request #3366 by neomantra (2013-06-27 18:54:09+00:00)
Title: digital_ocean: add 'unique' argument

The only property which uniquely identifies a droplet is its ID. However, when
one creates a droplet, you cannot specify an ID but rather its name, image_id,
region_id, and size_id.

Thus every time the following task is run, a new droplet is created:

- digital_ocean >
state=present
name=webserver1
ssh_key_ids=om2
size_id=66
region_id=1
image_id=345791

Similarly, to delete that droplet, you will need to go out-of-band and find
the droplet id (the inventory script I committed can help with that though):

- digital_ocean >
state=absent
id=123456

This changeset adds the 'unique' argument, which declares that all the
information uniquely identifies the droplet, so the module can scan
all the droplets for a match, rather than searching by ID.

So now, in addition to creating just one droplet using unique=yes, you can
write:

- digital_ocean >
state=absent
name=webserver1
size_id=66
region_id=1
image_id=345791

NOTE: since the Droplet API does not return associated SSH keys,
we cannot measure uniqueness using ssh_key_ids