Commit a1ea1514 by Ralph Bean

Remove trailing whitespace in digital ocean module.

parent 3eab663f
...@@ -33,7 +33,7 @@ options: ...@@ -33,7 +33,7 @@ options:
- Indicate desired state of the target. - Indicate desired state of the target.
default: present default: present
choices: ['present', 'active', 'absent', 'deleted'] choices: ['present', 'active', 'absent', 'deleted']
client_id: client_id:
description: description:
- Digital Ocean manager id. - Digital Ocean manager id.
api_key: api_key:
...@@ -58,7 +58,7 @@ options: ...@@ -58,7 +58,7 @@ options:
description: description:
- Optional, comma separated list of ssh_key_ids that you would like to be added to the server - Optional, comma separated list of ssh_key_ids that you would like to be added to the server
wait: wait:
description: description:
- Wait for the droplet to be in state 'running' before returning. If wait is "no" an ip_address may not be returned. - Wait for the droplet to be in state 'running' before returning. If wait is "no" an ip_address may not be returned.
default: "yes" default: "yes"
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
...@@ -81,25 +81,25 @@ EXAMPLES = ''' ...@@ -81,25 +81,25 @@ EXAMPLES = '''
# If no existing key matches this name, a new key is created, the ssh key id is returned and changed = False # If no existing key matches this name, a new key is created, the ssh key id is returned and changed = False
- digital_ocean: > - digital_ocean: >
state=present state=present
command=ssh command=ssh
name=my_ssh_key name=my_ssh_key
ssh_pub_key='ssh-rsa AAAA...' ssh_pub_key='ssh-rsa AAAA...'
client_id=XXX client_id=XXX
api_key=XXX api_key=XXX
# Create a new Droplet # Create a new Droplet
# Will return the droplet details including the droplet id (used for idempotence) # Will return the droplet details including the droplet id (used for idempotence)
- digital_ocean: > - digital_ocean: >
state=present state=present
command=droplet command=droplet
name=my_new_droplet name=my_new_droplet
client_id=XXX client_id=XXX
api_key=XXX api_key=XXX
size_id=1 size_id=1
region_id=2 region_id=2
image_id=3 image_id=3
wait_timeout=500 wait_timeout=500
register: my_droplet register: my_droplet
- debug: msg="ID: {{ my_droplet.droplet.id }} IP: {{ my_droplet.droplet.ip_address }}" - debug: msg="ID: {{ my_droplet.droplet.id }} IP: {{ my_droplet.droplet.ip_address }}"
...@@ -109,30 +109,30 @@ EXAMPLES = ''' ...@@ -109,30 +109,30 @@ EXAMPLES = '''
# If no droplet matches the id, a new droplet will be created and the droplet details (including the new id) are returned, changed = True. # If no droplet matches the id, a new droplet will be created and the droplet details (including the new id) are returned, changed = True.
- digital_ocean: > - digital_ocean: >
state=present state=present
command=droplet command=droplet
id=123 id=123
name=my_new_droplet name=my_new_droplet
client_id=XXX client_id=XXX
api_key=XXX api_key=XXX
size_id=1 size_id=1
region_id=2 region_id=2
image_id=3 image_id=3
wait_timeout=500 wait_timeout=500
# Create a droplet with ssh key # Create a droplet with ssh key
# The ssh key id can be passed as argument at the creation of a droplet (see ssh_key_ids). # The ssh key id can be passed as argument at the creation of a droplet (see ssh_key_ids).
# Several keys can be added to ssh_key_ids as id1,id2,id3 # Several keys can be added to ssh_key_ids as id1,id2,id3
# The keys are used to connect as root to the droplet. # The keys are used to connect as root to the droplet.
- digital_ocean: > - digital_ocean: >
state=present state=present
ssh_key_ids=id1,id2 ssh_key_ids=id1,id2
name=my_new_droplet name=my_new_droplet
client_id=XXX client_id=XXX
api_key=XXX api_key=XXX
size_id=1 size_id=1
region_id=2 region_id=2
image_id=3 image_id=3
''' '''
...@@ -198,7 +198,7 @@ class Droplet(JsonfyMixIn): ...@@ -198,7 +198,7 @@ class Droplet(JsonfyMixIn):
def destroy(self): def destroy(self):
return self.manager.destroy_droplet(self.id) return self.manager.destroy_droplet(self.id)
@classmethod @classmethod
def setup(cls, client_id, api_key): def setup(cls, client_id, api_key):
cls.manager = DoManager(client_id, api_key) cls.manager = DoManager(client_id, api_key)
...@@ -283,10 +283,10 @@ def core(module): ...@@ -283,10 +283,10 @@ def core(module):
droplet = Droplet.find(module.params['id']) droplet = Droplet.find(module.params['id'])
if not droplet: if not droplet:
droplet = Droplet.add( droplet = Droplet.add(
name=getkeyordie('name'), name=getkeyordie('name'),
size_id=getkeyordie('size_id'), size_id=getkeyordie('size_id'),
image_id=getkeyordie('image_id'), image_id=getkeyordie('image_id'),
region_id=getkeyordie('region_id'), region_id=getkeyordie('region_id'),
ssh_key_ids=module.params['ssh_key_ids'] ssh_key_ids=module.params['ssh_key_ids']
) )
if droplet.is_powered_on(): if droplet.is_powered_on():
...@@ -296,7 +296,7 @@ def core(module): ...@@ -296,7 +296,7 @@ def core(module):
wait_timeout=getkeyordie('wait_timeout') wait_timeout=getkeyordie('wait_timeout')
) )
module.exit_json(changed=changed, droplet=droplet.to_json()) module.exit_json(changed=changed, droplet=droplet.to_json())
elif state in ('absent', 'deleted'): elif state in ('absent', 'deleted'):
droplet = Droplet.find(getkeyordie('id')) droplet = Droplet.find(getkeyordie('id'))
if not droplet: if not droplet:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment