ansible/ansible — pull request #4919 by sivel (2013-11-15 18:29:17+00:00)
Title: Refactor rax module. Fixes #4577

## Changes

1. Deprecate the **_service_** attribute
1. Provide more information about the instance; pyrax provides a lot, the rax module exposes few, new attributes follow naming conventions used in the rax.py inventory script (adding rax_, lowercasing attr names and replacing non standard chars with underscores). Attributes returned previously are maintained as well, to prevent backwards incompatibilities.
1. Allow image `name` or `human_id` in addition to the image `id` for the **_image_** attribute. `human_id` is preferred
1. Allow a **_count_** attribute, to spin up more than a single instance at a time
1. Make `present` state idempotent, this relies on the following attributes: **_count_**, **_group_**, and ***exact_count***
1. Allow **_name_** attribute to have a single string format character for the automatic hostname number increment used with **_group_**
1. Allow a ***count_offset*** attribute to offset the start of the automatic hostname number increment as mentioned above
1. Allow easy specification of the **_group_** (hostgroup) meta key used by the `rax` inventory script (this will also be used for the above idempotent functionality). This is exposed with a **_group_** attribute
1. Use the `search_opts` argument for `pyrax.cloudservers.servers.list()` to perform filtering via the API, where applicable
1. Provide an ***instance_ids*** attribute to be used for `deleted`/`absent` states (the existing functionality should remain too)
1. Remove `active` and `deleted` **_state_**s
1. Add support for cloud networks via the **_networks_** attribute. `id` and `label` are supported
1. Add support for ***disk_config***
1. When using **_group_**, the module will attempt to increment the host number, e.g. test0, test1, test2, etc… The name parameter will accept printf formatting to identify where the host number should go
1. `action` is a new key/attribute is returned by the `rax` module. This will have a value of `create`, `delete` or `None`. This is to help identify the situation where, with ***exact_count*** you know if servers were created or deleted.
1. `instance_ids` is a new key/attribute is returned by the `rax` module. This will contain a list of the ids for instances that were either created or removed.
1. Always return data even on failures so you can use `failed_when`
1. When using **_group_** and ***exact_count*** it probably makes the most sense to always use a **_state_** of `present` and set the **_count_** to `0` to remove them all.

## Examples

See https://gist.github.com/sivel/7076710