Commit Graph

17 Commits (df529b9b69efeeafc9b5f97d9d006c82824c14eb)

Author SHA1 Message Date
James Cammarata 484297cfa8 Added a version_added string to the new digital_ocean module param 11 years ago
Ralph Bean a9a2a96218 Add a new unique_name param to the digital_ocean module for idempotence.
As it stands now, it is difficult to write idempotent tasks for digital
ocean droplets.  Digital ocean assigns new nodes a random id when they
are provisioned and that id is the only key that can be used to identify
it in subsequent runs of that play.

The workflow previously involved manual intervention:

- write a play defining a new node with no specified id
- run it, collect the randomly assigned id by hand
- modify the play to add the id by hand so future runs don't create
  duplicate nodes
- perform future re-runs that check if the node exists (by its id)
  - if it does exist then do nothing.
  - if it does not exist, then create it and return a *new random id*
  - collect the new random id by hand, modify the playbook file, and
    start all over.

Its a huge pain.

The modifications in this commit allow you to use the 'hostname' as a
primary key for idempotence with digital ocean.  By default, digital
ocean will let you create as many hosts with the same hostname as you
like.  Here, we provide an option to constrain the user to using only
unique hostnames.

The workflow will now look like:

- write a play defining a new node with a specified hostname and
  "unique_name: true""
- run it, create the new node and move on.
- re-run it, notice that a node with that hostname is already created
  and move on.
11 years ago
Ralph Bean 6ecf41530b Fix an example with a yaml syntax error. 11 years ago
Ralph Bean d782d91b80 Fix some "make pep8" errors in the digital_ocean module. 11 years ago
Ralph Bean a1ea15141e Remove trailing whitespace in digital ocean module. 11 years ago
Ralph Bean 3eab663f2e Remove duplicate docs in digital ocean module.
The EXAMPLES block here has two copies of the same docs,
one nicely formatted, the other less so.

It looks like a pass was made to clean up the docs but the old
cruftier ones were never removed.
11 years ago
Bryan Larsen cea812c3a7 update_attr should wait for the full wait timeout before checking for a missing IP addres 11 years ago
Bryan Larsen 848b38fc7f digital_ocean doc update 11 years ago
Bryan Larsen bdbc963736 digital_ocean: don't run update_attr if wait=no
Sometimes when using digital_ocean with wait=no I get the error "No ip is found".  But with wait=no I wouldn't expect there to be any IP, that gets allocated later.   However, looking at the code, it turns out that with even with wait=no it waits up to 10 seconds for an IP to be allocated.  We could wait longer, but with wait=no that seems like the wrong choice; it's easy enough to grab an IP later with a wait=yes command.

To make this change I removed the call to update_attr in @classmethod add.  An add is always followed by an ensure_powered_on which will do the update_attr if wait=yes.   It would be possible to instead do a call to update_attr with no retries and ignore the errors but I figured it would be better to be consistently not return an IP than to sometimes return it and sometimes not.   Inconsistent behaviour makes debugging deployment scripts very difficult.
11 years ago
Benjamin Schwarze 31bc25063e fix wrong argument_spec in digital_ocean module
as 'required' and 'default' are mutually exclusive removed 'required' in preference of 'default'
11 years ago
Michael DeHaan 995ef374db Fixup versions of newly added modules. 11 years ago
Michael DeHaan 3f8aa8aec5 Fix up some module docs formatting errors. 11 years ago
Michael DeHaan 231d9b101d YAML fix 11 years ago
Michael DeHaan faaa90ed03 Merge branch 'ocean' into devel
Conflicts:
	library/cloud/digital_ocean
11 years ago
Michael DeHaan c9c45ac597 Reformat examples 11 years ago
Vincent Viallet cc1cb01540 Rename digital ocean module to digital_ocean, add documentation. 11 years ago
Vincent Viallet d4b5122ad9 Rename digital ocean module to digital_ocean, add documentation. 11 years ago