mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make digital_ocean ssh command use API v2
This commit is contained in:
parent
15235a718d
commit
02883a460b
1 changed files with 79 additions and 83 deletions
|
@ -20,89 +20,88 @@ DOCUMENTATION = '''
|
||||||
module: digital_ocean
|
module: digital_ocean
|
||||||
short_description: Create/delete a droplet/SSH_key in DigitalOcean
|
short_description: Create/delete a droplet/SSH_key in DigitalOcean
|
||||||
description:
|
description:
|
||||||
- Create/delete a droplet in DigitalOcean and optionally wait for it to be 'running', or deploy an SSH key.
|
- Create/delete a droplet in DigitalOcean and optionally wait for it to be 'running', or deploy an SSH key.
|
||||||
version_added: "1.3"
|
version_added: "1.3"
|
||||||
options:
|
options:
|
||||||
command:
|
command:
|
||||||
description:
|
description:
|
||||||
- Which target you want to operate on.
|
- Which target you want to operate on.
|
||||||
default: droplet
|
default: droplet
|
||||||
choices: ['droplet', 'ssh']
|
choices: ['droplet', 'ssh']
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- 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:
|
||||||
- DigitalOcean manager id.
|
- DigitalOcean manager id.
|
||||||
api_key:
|
api_key:
|
||||||
description:
|
description:
|
||||||
- DigitalOcean api key.
|
- DigitalOcean api key.
|
||||||
id:
|
id:
|
||||||
description:
|
description:
|
||||||
- Numeric, the droplet id you want to operate on.
|
- Numeric, the droplet id you want to operate on.
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- String, this is the name of the droplet - must be formatted by hostname rules, or the name of a SSH key.
|
- String, this is the name of the droplet - must be formatted by hostname rules, or the name of a SSH key.
|
||||||
unique_name:
|
unique_name:
|
||||||
description:
|
description:
|
||||||
- Bool, require unique hostnames. By default, DigitalOcean allows multiple hosts with the same name. Setting this to "yes" allows only one host per name. Useful for idempotence.
|
- Bool, require unique hostnames. By default, DigitalOcean allows multiple hosts with the same name. Setting this to "yes" allows only one host per name. Useful for idempotence.
|
||||||
version_added: "1.4"
|
version_added: "1.4"
|
||||||
default: "no"
|
default: "no"
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
size_id:
|
size_id:
|
||||||
description:
|
description:
|
||||||
- This is the slug of the size you would like the droplet created with.
|
- This is the slug of the size you would like the droplet created with.
|
||||||
image_id:
|
image_id:
|
||||||
description:
|
description:
|
||||||
- This is the slug of the image you would like the droplet created with.
|
- This is the slug of the image you would like the droplet created with.
|
||||||
region_id:
|
region_id:
|
||||||
description:
|
description:
|
||||||
- This is the slug of the region you would like your server to be created in.
|
- This is the slug of the region you would like your server to be created in.
|
||||||
ssh_key_ids:
|
ssh_key_ids:
|
||||||
description:
|
description:
|
||||||
- Optional, array of of ssh_key_ids that you would like to be added to the server.
|
- Optional, array of of ssh_key_ids that you would like to be added to the server.
|
||||||
virtio:
|
virtio:
|
||||||
description:
|
description:
|
||||||
- "Bool, turn on virtio driver in droplet for improved network and storage I/O."
|
- "Bool, turn on virtio driver in droplet for improved network and storage I/O."
|
||||||
version_added: "1.4"
|
version_added: "1.4"
|
||||||
default: "yes"
|
default: "yes"
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
private_networking:
|
private_networking:
|
||||||
description:
|
description:
|
||||||
- "Bool, add an additional, private network interface to droplet for inter-droplet communication."
|
- "Bool, add an additional, private network interface to droplet for inter-droplet communication."
|
||||||
version_added: "1.4"
|
version_added: "1.4"
|
||||||
default: "no"
|
default: "no"
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
backups_enabled:
|
backups_enabled:
|
||||||
description:
|
description:
|
||||||
- Optional, Boolean, enables backups for your droplet.
|
- Optional, Boolean, enables backups for your droplet.
|
||||||
version_added: "1.6"
|
version_added: "1.6"
|
||||||
default: "no"
|
default: "no"
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
user_data:
|
user_data:
|
||||||
description:
|
description:
|
||||||
- opaque blob of data which is made available to the droplet
|
- opaque blob of data which is made available to the droplet
|
||||||
version_added: "1.10"
|
version_added: "1.10"
|
||||||
required: false
|
required: false
|
||||||
default: None
|
default: None
|
||||||
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" ]
|
||||||
wait_timeout:
|
wait_timeout:
|
||||||
description:
|
description:
|
||||||
- How long before wait gives up, in seconds.
|
- How long before wait gives up, in seconds.
|
||||||
default: 300
|
default: 300
|
||||||
ssh_pub_key:
|
ssh_pub_key:
|
||||||
description:
|
description:
|
||||||
- The public SSH key you want to add to your account.
|
- The public SSH key you want to add to your account.
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
- Two environment variables can be used, DO_CLIENT_ID and DO_API_KEY.
|
- Two environment variables can be used, DO_API_KEY and DO_API_TOKEN. They both refer to the v2 token.
|
||||||
- Version 1 of DigitalOcean API is used.
|
|
||||||
requirements: [ dopy ]
|
requirements: [ dopy ]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -117,7 +116,6 @@ EXAMPLES = '''
|
||||||
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
|
|
||||||
api_key=XXX
|
api_key=XXX
|
||||||
|
|
||||||
# Create a new Droplet
|
# Create a new Droplet
|
||||||
|
@ -145,7 +143,6 @@ EXAMPLES = '''
|
||||||
command=droplet
|
command=droplet
|
||||||
id=123
|
id=123
|
||||||
name=mydroplet
|
name=mydroplet
|
||||||
client_id=XXX
|
|
||||||
api_key=XXX
|
api_key=XXX
|
||||||
size_id=2gb
|
size_id=2gb
|
||||||
region_id=ams2
|
region_id=ams2
|
||||||
|
@ -161,7 +158,6 @@ EXAMPLES = '''
|
||||||
state=present
|
state=present
|
||||||
ssh_key_ids=[id1,id2]
|
ssh_key_ids=[id1,id2]
|
||||||
name=mydroplet
|
name=mydroplet
|
||||||
client_id=XXX
|
|
||||||
api_key=XXX
|
api_key=XXX
|
||||||
size_id=2gb
|
size_id=2gb
|
||||||
region_id=ams2
|
region_id=ams2
|
||||||
|
@ -285,7 +281,7 @@ class SSH(JsonfyMixIn):
|
||||||
|
|
||||||
@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, api_version=2)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find(cls, name):
|
def find(cls, name):
|
||||||
|
|
Loading…
Reference in a new issue