ansible/ansible — pull request #7944 by smashwilson (2014-06-26 21:44:03+00:00)
Title: Extend rax_clb module to configure SSL termination and HTTPS redirection.

Rackspace Cloud Load Balancers support [SSL termination](http://docs.rackspace.com/loadbalancers/api/v1.0/clb-devguide/content/SSLTermination-d1e2479.html) and HTTPS redirection. This updates the existing `rax_clb` module to add two new parameters:

* `https_redirect` enables or disables HTTPS redirection. (Note that this can only be done for the HTTPS protocol, or for HTTP with SSL termination enabled and secure_traffic_only.
* `ssl_termination` uses a dictionary to configure SSL termination. `private_key` and `certificate` are its required keys; `secure_port`, `enabled`, `intermediate_certificate`, and `secure_traffic_only` are also accepted.

The module is still idempotent: SSL termination and redirection will be enabled or disabled on existing load balancers as necessary. I also added the new keys to the documentation.

Here's an example call, from rackerlabs/developer.rackspace.com#415:

```yaml
- name: Provision production web load balancer
rax_clb:
credentials: ~/.rackspace_cloud_credentials
name: "prod_{{ server_name }}"
port: 80
protocol: HTTP
algorithm: ROUND_ROBIN
type: PUBLIC
timeout: 30
region: "{{ lookup('env', 'RAX_REGION') | upper }}"
ssl_termination:
private_key: "{{ lookup('file', 'credentials/' + server_name + '.key') }}"
certificate: "{{ lookup('file', 'credentials/' + server_name + '.crt') }}"
secure_traffic_only: yes
https_redirect: yes
wait: yes
state: present
register: clb_prod
```

One caveat: to use either of these, I needed to add implicit `waits` in the middle of the module: one to wait for the initial balancer to become active, and another to wait for the SSL settings to be applied. You can't do it all at once, and load balancers are immutable until their state reaches "READY".

I'm all ears for feedback :wink:

/cc @sivel, @claco